开发者

How can I detect and convert text encoding?

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开发者_如何学Python "¿©¼º ½̾ ±â"), the application is often killed with alert dialog "adl quit unexpectedly". How can I make my application more endurable.

Thank you in advance.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜