Sandy
Sandy

Reputation: 14125

mac java encoding for german umlaut characters

I have created an test swt application which has some German special characters. When I run this application from eclipse it works fine but if I create jar of application and run jar from terminal it shows wrong special characters.

For example I have shown "Sie sind sicher, dass Sie, um die Aufnahme zu schließen?" message on closing the application but when I run application from terminal it shows characters as shown in image.

enter image description here

As you can see in image there are some special characters which are not displayed correctly.

I am using Mac Lion. JDK details are

java version "1.6.0_31" Java(TM) SE Runtime Environment (build 1.6.0_31-b04-415-11M3646) Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01-415, mixed mode)

I am running application from terminal using following command

java -cp :./final/* mypackege.MainClass -d32 -Dfile.encoding=UTF-8

I tried specifying UTF encoding from commandline but no effect.

Upvotes: 1

Views: 1262

Answers (1)

Jon Skeet
Jon Skeet

Reputation: 1500855

You haven't told us how you're getting the string, but if it's in the source code, it's probably just a matter of specifying the encoding when you build, e.g.

javac -encoding UTF-8 ...

Obviously tailor this to whatever encoding your source code is actually in.

Upvotes: 1

Related Questions