utf-16 problems when using writeUTFBytes and readUTFBytes
I'm really confused about the 'unicode' chatset as it does not seem to do what I would think it would do.
Every utf16 character is represented by 2 bytes. So a "C" would have 2 bytes [67,0], a chinese character would have 2 bytes also.
var testStr:String = '漢語';
var testBA:ByteArray = new ByteArray();
testBA.writeMultiByte(testStr,'unicode');
testBA.position = 0;
for(var a=0;a<testBA.length;a++)
{
trace(testBA);
}
var str:String = testBA.readMultiByte(testBA.length,'unicode');
trace(str);
OUTPUT:
63
63
??
The testBA should have 4 bytes shouldnt it?
Can anyone show an example of how to convert my test String to and then back from UTF-16?