开发者

Why does writeUTFBytes mess up non-english characters?

开发者 https://www.devze.com 2022-12-27 20:37 出处:网络
I\'m writing all sorts of multi lingual text to .txt files using A开发者_C百科IR\'s fileStream.writeUTFBytes()

I'm writing all sorts of multi lingual text to .txt files using A开发者_C百科IR's

fileStream.writeUTFBytes()

For english characters everything works perfectly. But as soon as there are chinese, arabic or any other non-english characters the sentences are totally messed up.

For example:

对着大叔摄影师的确没爱....

becomes

对着大叔摄影师的确没爱....

How can this be fixed?


writeUTFBytes doesn't mess up anything since it doesn't process the content.
Whatever goes in the pipe comes out.

The text you are sending is most likely encoded in Unicode/UTF-8
Make sure that you are openning the file with an editor that supports unicode (even Windows Notepad supports it, but it defaults to ANSI).

0

精彩评论

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