• Post Reply Bookmark Topic Watch Topic
  • New Topic

Writing Chinese Characters to a File  RSS feed

 
Gilbert johnson
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have these chinese characters stored in the database in NCR format
eg: &# 25705;&# 26681;&# 22823;&# 36890; -->Something like this (I've purposely added the space after &#).

When you view these characters in the browser - they appear as chinese.

So I need to write these characters to an excel file (CSV), and in excel file they would not appear as Chinese. So I played around a bit, I found a function online that converts a string in NCR format to unicode. So I used that function and used the fileoutputstream to write these characters and it WORKED.



This was in JDK 1.4.2.08 - Now when I compile the same code in JDK 1.6 -> it does not that any methods are deprecated - but the chinese characters dont show up - instead some junk characters are displayed in the excel file.

What am I missing. Will appreciate any of your insights.
Thanks
Gubloo
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure how that could have worked in Java 1.4, but "Unicode" is not a character encoding. The javadocs for the java.nio.charset.Charset class list some of the possibilities, e.g. "UTF-8", which is the most commonly used Unicode encoding.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!