How to save Chinese Characters to file with java ?
- by Frank
I use the following code to save Chinese characters into a .txt file, but when I opened it with wordpad, I can't read it.
StringBuffer Shanghai_StrBuf=new StringBuffer("\u4E0A\u6D77");
boolean Append=true;
FileOutputStream fos;
fos=new FileOutputStream(FileName,Append);
for (int i=0;i<Shanghai_StrBuf.length();i++) fos.write(Shanghai_StrBuf.charAt(i));
fos.close();
What can I do ? I know if I cut and paste Chinese characters into a wordpad I can save it into a .txt file. How to do that with java ?