My OS is windows 7 with Hebrew locale and using Java 6 in my code.
I’ve changed my locale to English(United States) and also the display language to English.
I restarted my PC and then in my java code tried to get the default charset as follow:
String str = Charset.defaultCharset().name();
The result, str is set to windows-1255.
Which means that it still using the Hebrew as the default charset.
What seems to be the problem?
Going by OpenJDK sources,
file.encodingand thusdefaultCharset()is set on Windows according to:Java 6:
GetUserDefaultLCIDAPI function which corresponds to the Format option on the Formats tab of the Region and Language control panel applet.Java 7:
GetSystemDefaultLCIDAPI function which corresponds to the “Language for non-Unicode programs” on the Administrative tab of the Region and Language control panel applet, unless you set thesun.locale.formatasdefaultJava system property totrue, which will revert to the Java 6 behavior.So for Java 6 the Format is the setting to change.