用URLLoader加载XML,然后将data转化为ByteArray
用byteArray.readMultiByte(bytes.length,"utf-8")
然后将转化后的字符串再强制转化为XML
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.Binary;
var urlRequest:URLRequest = new URLRequest(source);
loader.addEventListener("complete",completeHandler);
loader.load(urlRequest);
private var completeHandler(evt:Event):void
{
var bytes:ByteArray = ByteArray(evt.currentTarget.data);
var xmlStr:String = bytes.readMultiByte(bytes.length,"utf-8");
var xml:XML = XML(xmlStr);
trace(xml);
}
Flex读取外部XML中文乱码解决办法
最新推荐文章于 2024-10-30 16:19:48 发布