UnicodeLittle is broken on 1.4.2_12, the following test fails on 1.4.2_12 and works on older versions such as 1.4.2_06:
public class TestUnicodeLittle {
public static void main(String[] args) throws Exception {
byte[] unicodeLittleBytes = new byte[]{68,0,83,0,75,0,80,0,79,0,79,0,76,0,53,0,51,0};
String unicodeLittleStr = new String(unicodeLittleBytes, "UnicodeLittle");
System.out.println("Actual output: " + unicodeLittleStr);
System.out.println("Expected output: DSKPOOL53");
if ("DSKPOOL53".equals(unicodeLittleStr)) {
System.out.println("Test passed");
} else {
System.out.println("Test failed");
}
}
}
Test output on 1.4.2_06:
$ java -version
java version "1.4.2_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_06-b03)
Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode)
$ java -cp . TestUnicodeLittle
Actual output: DSKPOOL53
Expected output: DSKPOOL53
Test passed
$
Output on 1.4.2_12:
$ java -version
java version "1.4.2_12"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_12-b03)
Java HotSpot(TM) Client VM (build 1.4.2_12-b03, mixed mode)
$ java -cp . TestUnicodeLittle
Actual output: ?????????
Expected output: DSKPOOL53
Test failed
$