views:

17

answers:

1

Some text (or html) document from web is not encoded as UTF-8, so I want to convert encoding of text document to UTF-8. Do you have any clues for dealing with text encoding?

And I found that, when application draws element with encoding-broken text (such as "¿©¼º ½̾ ±â"), the application is often killed with alert dialog "adl quit unexpectedly". How can I make my application more endurable.

Thank you in advance.

A: 

Flash Player uses UTF-8 by default. You can change this via System.useCodePage but it still will use only ONE encoding (depends on the client machine).

If you want to load text with arbitrary encoding, you should load text as ByteArray and then parse it manually into string. Not sure if there are some libs for this.

P.S: If you get a chance - convert all your incoming data to UTF-8 on the server or somewhere - not on the client.

Maxim Kachurovskiy
Thank you very much. I could solve this problem on the client using ByteArray.
Jason