Why does writeUTFBytes mess up non-english characters?
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).
精彩评论