I have a need to take a string that is encoded as hex bytes and decode
it into a utf8 string.

For example:
30 30 30 
would be 000

This works fine since chars <0x7f are standard ascii in utf8. The
problem is taking this concept and trying to decode a utf8 string with
bytes >0x7f.

For example, the sequence:
e8 8b b1 e8 aa 9e
should display two Japanese characters.

I do not know how to create a string with these values that will
display properly as utf8.  One problem is that I do not know how Flex
internally stores utf8 strings.  If I cut-and-paste the actual utf8
string from a file into Flex, the JA characters show up fine in the
editor, debugger and the application. 

[I am not sure if this will show up for you but let's try]
public var test:String="&#33521;&#35486;";

So clearly Flex can understand a sequence of bytes in a String object
as utf8.  But how to create it? If I try to create a string using the
bytes, it fails. For example

public var test2:String="\xe8\x8b\xb1\xe8\xaa\x9e";

does not display properly.  If I view these to vars in the debugger.
the test var is correct, whereas the test2 is junk.

I have not experimented with the ByteArray class, as I know there are
some utf8 specific functions, but why won't this work?  The MX file is
encoded as utf8, and as I said Flex understands utf8 strings just fine
so why can't I take each byte value and concatenate to get a utf8 string?




Reply via email to