readUTFBytes() not returning the correct characters
I am reading in a text file using FileReference() in a small AIR app i'm buliding. This text file contains translations for the site I'm working on, in a bunch of different languages. I correctly receive the byteArray in the data parameter of the FileReference object I created. I am using readUTFBytes() to convert the entire data block to a String so I can parse through it and create an XML for all the different phrases and such. I am finding that most characters are read correctly into the String except for example Ž (utf-8 code 142). I trace the index value in the byteArray and correctly get the binary value 10001110 (142). If I try and readUTFBytes() on this byte individually I get nothing in the character result.
var ba:ByteArray = new ByteArray();
ba.writeBytes( _loadFile.data, 126, 1 ); //where 126 is the index of the character...yes I quintuple checked it's the correct index ![]()
ba.position = 0; //not necessary but for safe measure
var char:String = ba.readUTFBytes(ba.bytesAvailable);
trace( char );
char traces blank. And the local variable value in Flashdevelop and Flash Builder is "".
I've tried readMultiByte() with a bunch of different charSet types as well, but nothing has yielded the correct character for this value (and many others).
Has anybody ever worked with loaded text files with odd characters and run into (and hopefully solved) this issue?
Thanks
