P
pasmol
Hi,
I need to setup default encoding for jBoss/Tomcat. I tried to use
file.encoding property,
but it doesn't work.
I wrote simple test:
public class Test {
public static void main(String[] args) {
System.out.println(sun.io.Converters.getDefaultEncodingName());
System.out.println(System.getProperty("file.encoding"));
}
}
.... and run it in two different environments:
1) Win2KProPL
C:\TEMP>java -version
java version "1.4.2_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)
C:\TEMP>javac Test.java
C:\TEMP>java Test
Cp1250
Cp1250
C:\TEMP>java -Dfile.encoding=ISO8859_2 Test
Cp1250
ISO8859_2
2) RedHat9
[root@stefan share]# java -version
java version "1.4.2_05"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04)
Java HotSpot(TM) Client VM (build 1.4.2_05-b04, mixed mode)
[root@stefan share]# javac Test.java
[root@stefan share]# java Test
UTF-8
UTF-8
[root@stefan share]# java -Dfile.encoding=ISO8859_2 Test
UTF-8
ISO8859_2
I tried also other names (iso-8859-2, 8859_2, etc.), but with the same
result.
Does anyone know the reason for ignoring file.encoding?
I debugged SCSL sources of sun.io.Converters, and it seems that
file.encoding must
have been set before.
public static String getDefaultEncodingName() {
synchronized (lock) {
if (defaultEncoding == null) {
java.security.PrivilegedAction pa =
new sun.security.action.GetPropertyAction("file.encoding");
defaultEncoding =
(String)java.security.AccessController.doPrivileged(pa);
}
}
return defaultEncoding;
}
Any idea?
Thanks in advance,
Piotr Smolinski
I need to setup default encoding for jBoss/Tomcat. I tried to use
file.encoding property,
but it doesn't work.
I wrote simple test:
public class Test {
public static void main(String[] args) {
System.out.println(sun.io.Converters.getDefaultEncodingName());
System.out.println(System.getProperty("file.encoding"));
}
}
.... and run it in two different environments:
1) Win2KProPL
C:\TEMP>java -version
java version "1.4.2_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)
C:\TEMP>javac Test.java
C:\TEMP>java Test
Cp1250
Cp1250
C:\TEMP>java -Dfile.encoding=ISO8859_2 Test
Cp1250
ISO8859_2
2) RedHat9
[root@stefan share]# java -version
java version "1.4.2_05"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04)
Java HotSpot(TM) Client VM (build 1.4.2_05-b04, mixed mode)
[root@stefan share]# javac Test.java
[root@stefan share]# java Test
UTF-8
UTF-8
[root@stefan share]# java -Dfile.encoding=ISO8859_2 Test
UTF-8
ISO8859_2
I tried also other names (iso-8859-2, 8859_2, etc.), but with the same
result.
Does anyone know the reason for ignoring file.encoding?
I debugged SCSL sources of sun.io.Converters, and it seems that
file.encoding must
have been set before.
public static String getDefaultEncodingName() {
synchronized (lock) {
if (defaultEncoding == null) {
java.security.PrivilegedAction pa =
new sun.security.action.GetPropertyAction("file.encoding");
defaultEncoding =
(String)java.security.AccessController.doPrivileged(pa);
}
}
return defaultEncoding;
}
Any idea?
Thanks in advance,
Piotr Smolinski