I have problems with reading text from an external XML. Flash doesn't seem to have problem with ascii characters from (32-127), but it isn't able to show extended characters (128 - 255). In that XML i have for example „ (DEC: 132) and “ (DEC:147). In the XML those characters are not visible, but still there. Flash isn't able to show them. My approach was to get each charCode and convert it to string, but that does only work for printable characters.
var textToConvert:String = xml.parameters.text[1].value;
trace("LENGTH = "+textToConvert.length);
var test:String="";
for(var i:int=1;i<textToConvert.length;i++){
trace(textToConvert.charCodeAt(i));
//OCT
trace(textToConvert.charCodeAt(i).toString(8));
//HEX
trace(textToConvert.charCodeAt(i).toString(16));
//HEX
test += textToConvert.charCodeAt(i).toString(16);
trace("SYMBOL : " +String.fromCharCode(textToConvert.charCodeAt(i)))
}
trace("TEST: "+test);
Result:
76
114
4c
SYMBOL : L
132
204
84
SYMBOL : (Not Visible)
The next thing i was doing, is to attach an escape sequence to each char "\x" to the HEX-Value and then convert it to String, but that doesn't work either:
s = "\x93\x93\x84\x93\x84";
ba.writeMultiByte(s,"ASCII");
trace(s);
This was my first approach (not working):
var byteArray:ByteArray = new ByteArray();
byteArray.writeMultiByte(textToConvert,"iso-8859-1");
trace("HIER: "+byteArray.readUTFBytes(byteArray.bytesAvailable));
What would be an universal apporach to solve this problem?
This is the xml, it has hidden ascii characters (quotes). I want to parse the values of the nodes including those characters: