Skip to main content

UTF gone?

1 reply [Last post]
mcasspj
Offline
Joined: 2013-01-02

Hi All
I'm very new to java so be gentle :-)
Over Christmas I wrote a little self test desktop application for Chinese vocabulary.
I'm using Netbeans 7.3 beta 2 and all is fine.
I can clearly see simplified chinese characters as next: ?

However if I try to run it from the jar
C:\Users\mcasspj.DS\Documents\NetBeansProjects>java -jar .\Chinese1\dist\Chinese1.jar
it doesn't seem to recognise UTF and instead of Chinese characters I get:

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
mcasspj
Offline
Joined: 2013-01-02

Finally sorted it!
Basically Windows was overriding the file encoding and not using utf8
See http://stackoverflow.com/questions/1336930/how-do-you-specify-a-java-fil...

C:\Users\mcasspj\Documents\NetBeansProjects\Chinese1\dist>java -Dfile.encoding=utf8 -jar Chinese1.jar

Works a treat.

Paul