FULL PRODUCT VERSION :
java version "1.6.0_02"
Java(TM) SE Runtime Environment (build 1.6.0_02-b06)
Java HotSpot(TM) Client VM (build 1.6.0_02-b06, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
When invoking a class from the command line with arguments that contain characters higher than 0xFF, the arguments in the String array passed to the class' main method do not match the arguments specified on the command line.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the test program, and specify an argument with a character higher than 0xFF. (see attachment for sample)
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Expect the test program to print the same output twice -- once for the hard-coded string and once for the same characters specified on the command line.
ACTUAL -
The first set of output (for the hard-coded string is correct), but the second set is not:
A?
0x41
0x3c0
Ap
0x41
0x70
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class Test
{
public static void main (String[] args)
{
String testStr1 = "A\u03c0";
System.out.println(testStr1);
printHexVals(testStr1);
if (args.length > 0) {
String testStr2 = args[0];
System.out.println();
System.out.println(testStr2);
printHexVals(testStr2);
}
}
private static void printHexVals(String str) {
for (int i=0; i<str.codePointCount(0, str.length()); i++) {
System.out.println("0x" + Integer.toHexString(str.codePointAt(i)));
}
}
}
---------- END SOURCE ----------
java version "1.6.0_02"
Java(TM) SE Runtime Environment (build 1.6.0_02-b06)
Java HotSpot(TM) Client VM (build 1.6.0_02-b06, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
When invoking a class from the command line with arguments that contain characters higher than 0xFF, the arguments in the String array passed to the class' main method do not match the arguments specified on the command line.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the test program, and specify an argument with a character higher than 0xFF. (see attachment for sample)
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Expect the test program to print the same output twice -- once for the hard-coded string and once for the same characters specified on the command line.
ACTUAL -
The first set of output (for the hard-coded string is correct), but the second set is not:
A?
0x41
0x3c0
Ap
0x41
0x70
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class Test
{
public static void main (String[] args)
{
String testStr1 = "A\u03c0";
System.out.println(testStr1);
printHexVals(testStr1);
if (args.length > 0) {
String testStr2 = args[0];
System.out.println();
System.out.println(testStr2);
printHexVals(testStr2);
}
}
private static void printHexVals(String str) {
for (int i=0; i<str.codePointCount(0, str.length()); i++) {
System.out.println("0x" + Integer.toHexString(str.codePointAt(i)));
}
}
}
---------- END SOURCE ----------
- duplicates
-
JDK-6727466 java.exe/JRE1.6.0_10-b25/b27 doesn't seem to handle international characters
- Closed
-
JDK-7027461 Command Line Arguments not Encoded Properly
- Closed
- relates to
-
JDK-8124977 cmdline encoding challenges on Windows
- Open
-
JDK-8272352 Java launcher can not parse Chinese character when system locale is set to UTF-8
- Resolved