-
Bug
-
Resolution: Fixed
-
P2
-
1.4.2, 5.0
-
b29
-
x86
-
linux, windows_xp
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2224108 | 5.0u38 | Mala Bankal | P1 | Closed | Fixed | b01 |
JDK-2224925 | 5.0u36 | Mala Bankal | P1 | Resolved | Fixed | b31 |
JDK-2224033 | 5.0u35 | Mala Bankal | P1 | Resolved | Fixed | b31 |
java version "1.4.2_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_01-b06)
Java HotSpot(TM) Client VM (build 1.4.2_01-b06, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
EXTRA RELEVANT SYSTEM CONFIGURATION :
Using English version of Windows.
Default locale is "en"
A DESCRIPTION OF THE PROBLEM :
Enclosed program does round-trip conversion of a string from default encoding to SJIS, and then back. When "ABC" is processed it correctly comes back as "ABC". When a single character string is processed, it comes back as an empty string.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run provided Java program
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Printed output should be:
roundTrip(A)=A
roundTrip(ABC)=ABC
ACTUAL -
Actual output is:
roundTrip(A)=
roundTrip(ABC)=ABC
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package gcr.db.test;
import java.nio.*;
import java.nio.charset.*;
/**
* Demonstrates apparent bug in SJIS encoding.
*/
public class SjisBug {
public static void main(String[] args) {
System.out.println("roundTrip(A)="+roundTrip("A")); // Gets empty string !
System.out.println("roundTrip(ABC)="+roundTrip("ABC")); // Gets ABC, as expected.
}
static String roundTrip(String str) {
Charset cs=Charset.forName("SJIS");
return cs.decode(cs.encode(str)).toString();
}
}
---------- END SOURCE ----------
###@###.### 2004-11-18 04:18:09 GMT
- backported by
-
JDK-2224033 (cs) Many character decoders fail to convert single-byte (e.g. ASCII) input
-
- Resolved
-
-
JDK-2224925 (cs) Many character decoders fail to convert single-byte (e.g. ASCII) input
-
- Resolved
-
-
JDK-2224108 (cs) Many character decoders fail to convert single-byte (e.g. ASCII) input
-
- Closed
-
- duplicates
-
JDK-6211132 (cs) CharsetDecoder.decode(ByteBuffer) may return wrong result
-
- Closed
-
-
JDK-6372100 CharsetDecoder.decode fails for single-byte input for many CJK encodings
-
- Closed
-
-
JDK-8183182 Default Encoding provides wrong result for single character
-
- Closed
-