How to parse an XML document containing Chinese characters and get an XML bean
ragunath Mariappan
Greenhorn
Joined: Oct 29, 2007
Posts: 8
posted
0
Hello all,
(1) I parsed an XML document containing Chinese characters and got the XML bean as below:
(2) Then I tried to store it in a file as below:
(3) When I open "chineseCharsFile.xml" in a text editor, I'm able to see the Chinese characters, but when I open "newChineseCharsFile.xml" in the same text editor I'm not able to see the Chinese characters.
Any suggestions, please?
Thanks, Ragu
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35223
7
posted
0
If you don't specify an encoding when writing files, the platform default encoding will be used - which in all likelihood doesn't support Chinese characters. You can use an OutputStreamWriter wrapped around a FileOutputStream to accomplish this.