How to write chinese character to a text file
843838Apr 9 2007 — edited Apr 11 2007Hi experts,
I have been searching alot on this topic but none can solve my problem.
My problem is:
I have a string that contains both latin words and chinese characters that was input by the user.
I need to write this string to a text file. However, the chinese character always appear rubbish in my text file.
My code:
String text = "string containing latin and chinese character";
FileWriter fw = new FileWriter("abc.txt");
BufferedWriter bw = new BufferedWriter(fw);
bw.write(text);
bw.close();
Pls advise on how it should be done. Will appreciate if you can show me the code.
A million thanks!