来自:
http://hereson.iteye.com/blog/194271
?
代码如下:
//转码
??private function EncodeUtf8(str : String):String {
???var oriByteArr : ByteArray = new ByteArray();
???oriByteArr.writeUTFBytes(str);
???var tempByteArr : ByteArray = new ByteArray();
???trace(str);
???for (var i = 0; i<oriByteArr.length; i++) {
????if (oriByteArr[i] == 194) {
?????tempByteArr.writeByte(oriByteArr[i+1]);
?????i++;
????} else if (oriByteArr[i] == 195) {
?????tempByteArr.writeByte(oriByteArr[i+1] + 64);
?????i++;
????} else {
?????tempByteArr.writeByte(oriByteArr[i]);
????}
???}
???tempByteArr.position = 0;
???return tempByteArr.readMultiByte(tempByteArr.bytesAvailable,"chinese");
??}
?
使用方法:
EncodeUtf8(_sound.id3.songName)