Preserving multi-byte characters in Flex XML object
- by Dan Petker
I'm having an issue with the Flex XML object type mangling multi-byte characters (such as Japanese or Chinese characters).
The basic setup is this. I'm getting an XML-formatted string from the server, and in that string there can be multi-byte characters. A lot of the time, these characters are in attributes, for example:
<example id="foo" name="[some multi-byte characters]"/>
Now, when I examine the raw string, the multi-byte characters display just fine. However, as soon as I convert the string to an XML object using the top-level XML() function, all the multi-byte characters become mangled.
I've tried setting the XML's encoding by including an <?xml version="1.0" encoding="utf-8"?> element in the XML-formatted string, but this doesn't seem to have any effect on the resulting XML object.
Is there a way to get the XML object to respect the encoding of the XML-formatted string and prevent the multi-byte characters from being mangled?