-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
5.0
-
x86
-
windows_2000
FULL PRODUCT VERSION :
I have checked several JDK(include 1.4 and 1.5), this problem existing in all JDK. Here I only list 2 of thems.
------------------------------------
java version "1.4.1_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_02-b06)
Java HotSpot(TM) Client VM (build 1.4.1_02-b06, mixed mode)
----------------------------------------------
java version "1.5.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows 2000 [Version 5.00.2195]
A DESCRIPTION OF THE PROBLEM :
Description in JDK 1.4:
In %JAVA_HOME%/jre/lib/charset.jar, there are a class CharToByteCp500
The code like below (it is decompiled by JAD, so there maybe small different with acture source code):
public class CharToByteCp500 extends CharToByteSingleByte{
... ...
private static final String index2 = "\000\001\002\0037-./\026\005\025... ...";
... ...
}
Please look at last "\025", it is represented by oct format.
Acturely, in Cp500, \u000a are mapping to \0x25 instead of \025
Describe in JDK1.5
sun.nio.cs.ext.IBM500.Encoder have the same bug.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Test code like below:
String s = "1%2";
String s2=new String(s.getBytes("UTF-8"), "CP500");
String s3=new String(s.getBytes("CP500"), "UTF-8");
System.out.println("s3");
you can find that the "%" converted to a wrong char.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The console should display "1%2", but acturely it is wrong with the "%"
ACTUAL -
the "%" have converted to a bad char
ERROR MESSAGES/STACK TRACES THAT OCCUR :
see above
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
Test code like below:
String s = "1%2";
String s2=new String(s.getBytes("UTF-8"), "CP500");
String s3=new String(s.getBytes("CP500"), "UTF-8");
System.out.println("s3");
you can find that the "%" converted to a wrong char
---------- END SOURCE ----------
###@###.### 2005-2-03 23:48:18 GMT
I have checked several JDK(include 1.4 and 1.5), this problem existing in all JDK. Here I only list 2 of thems.
------------------------------------
java version "1.4.1_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_02-b06)
Java HotSpot(TM) Client VM (build 1.4.1_02-b06, mixed mode)
----------------------------------------------
java version "1.5.0_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows 2000 [Version 5.00.2195]
A DESCRIPTION OF THE PROBLEM :
Description in JDK 1.4:
In %JAVA_HOME%/jre/lib/charset.jar, there are a class CharToByteCp500
The code like below (it is decompiled by JAD, so there maybe small different with acture source code):
public class CharToByteCp500 extends CharToByteSingleByte{
... ...
private static final String index2 = "\000\001\002\0037-./\026\005\025... ...";
... ...
}
Please look at last "\025", it is represented by oct format.
Acturely, in Cp500, \u000a are mapping to \0x25 instead of \025
Describe in JDK1.5
sun.nio.cs.ext.IBM500.Encoder have the same bug.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Test code like below:
String s = "1%2";
String s2=new String(s.getBytes("UTF-8"), "CP500");
String s3=new String(s.getBytes("CP500"), "UTF-8");
System.out.println("s3");
you can find that the "%" converted to a wrong char.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The console should display "1%2", but acturely it is wrong with the "%"
ACTUAL -
the "%" have converted to a bad char
ERROR MESSAGES/STACK TRACES THAT OCCUR :
see above
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
Test code like below:
String s = "1%2";
String s2=new String(s.getBytes("UTF-8"), "CP500");
String s3=new String(s.getBytes("CP500"), "UTF-8");
System.out.println("s3");
you can find that the "%" converted to a wrong char
---------- END SOURCE ----------
###@###.### 2005-2-03 23:48:18 GMT