Preserving multi-byte characters in Flex XML object

Posted by Dan Petker on Stack Overflow See other posts from Stack Overflow or by Dan Petker
Published on 2010-04-01T17:30:21Z Indexed on 2010/04/01 17:33 UTC
Read the original article Hit count: 408

Filed under:
|
|
|

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?

© Stack Overflow or respective owner

Related posts about flex

Related posts about actionscript-3