Write text file with Chinese character is different on Win and Linux
807605Aug 9 2007 — edited Aug 9 2007Hi 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