Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Write text file with Chinese character is different on Win and Linux

807605Aug 9 2007 — edited Aug 9 2007
Hi All,

I retrieved the Chinese character from DB (which is UTF-8 encoding) and write the text to target file in server by FTP. I tried it in Windows, and success to read Chinese character from target file. However, I moved and run it in Linux platform, I cannot read the character which is replaced by '???'.

I known that when I retrieved the Chinese character from DB to java and write it out, the JVM converted the encoding from Unicode to MS950. I also checked the Linux platform cannot support Chinese encoding, the locale is en_US.

My question is why the windows would change encoding? the chinese character is UTF-8, then write it out with UTF-8 encoding is okay.

If the JVM is based on the default locale and file encoding setting to handle the special character, then the solution is to change the Linux's locale to zh_CN, right? any other solutions?

Thanks a lot.


Ivan
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 6 2007
Added on Aug 9 2007
13 comments
1,069 views