Skip to content

Commit ab408de

Browse files
psawant19jerboaa
authored andcommitted
8235834: IBM-943 charset encoder needs updating
Apply 34B003AF.RPMAP130 definition into encoder Reviewed-by: sgehwolf Backport-of: 1b925183894778acce8aff4c101f67af98f0097f
1 parent b3308b1 commit ab408de

File tree

2 files changed

+110
-3
lines changed

2 files changed

+110
-3
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#
2+
# source: 34B003AF.RPMAP130
3+
# c->b only entries
4+
#
5+
815C 2015
6+
8160 FF5E
7+
8161 2225
8+
817C FF0D
9+
88A0 555E
10+
898B 7130
11+
89A8 9DD7
12+
8A9A 5699
13+
8BA0 4FE0
14+
8BEB 8EC0
15+
8C71 7E6B
16+
8C74 8346
17+
8CB2 9E7C
18+
8D8D 9EB4
19+
8DF2 6805
20+
8EC6 5C62
21+
8F4A 7E61
22+
8FD3 8523
23+
8FDD 91AC
24+
90E4 87EC
25+
917E 6414
26+
9189 7626
27+
91CB 9A52
28+
925C 7C1E
29+
92CD 6451
30+
9355 5861
31+
935E 985A
32+
9398 79B1
33+
93C0 7006
34+
9458 56CA
35+
948D 525D
36+
94AC 6F51
37+
94AE 91B1
38+
966A 9830
39+
96CB 9EB5
40+
9789 840A
41+
9858 881F
42+
9BA0 5C5B
43+
9DB7 6522
44+
9E94 688E
45+
E379 7E48
46+
E445 8141
47+
E8F6 9839
48+
FA55 FFE4
49+
FA59 F86F

jdk/test/sun/nio/cs/TestIBMBugs.java

Lines changed: 61 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2008, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -22,13 +22,13 @@
2222
*/
2323

2424
/* @test
25-
@bug 6371437 6371422 6371416 6371619 5058184 6371431 6639450 6569191 6577466
26-
@summary Check if the problems reported in above bugs have been fixed
25+
@bug 6371437 6371422 6371416 6371619 5058184 6371431 6639450 6569191 6577466 8235834
2726
*/
2827

2928
import java.io.*;
3029
import java.nio.*;
3130
import java.nio.charset.*;
31+
import java.util.Arrays;
3232

3333
public class TestIBMBugs {
3434

@@ -172,6 +172,63 @@ private static void bug6577466 () throws Exception {
172172
}
173173
}
174174

175+
// Following test data is for 8235834
176+
private static final byte[] byteIBM943c2b = new byte[] {
177+
(byte)0x81, (byte)0x5C, (byte)0x81, (byte)0x60,
178+
(byte)0x81, (byte)0x61, (byte)0x81, (byte)0x7C,
179+
(byte)0x88, (byte)0xA0, (byte)0x89, (byte)0x8B,
180+
(byte)0x89, (byte)0xA8, (byte)0x8A, (byte)0x9A,
181+
(byte)0x8B, (byte)0xA0, (byte)0x8B, (byte)0xEB,
182+
(byte)0x8C, (byte)0x71, (byte)0x8C, (byte)0x74,
183+
(byte)0x8C, (byte)0xB2, (byte)0x8D, (byte)0x8D,
184+
(byte)0x8D, (byte)0xF2, (byte)0x8E, (byte)0xC6,
185+
(byte)0x8F, (byte)0x4A, (byte)0x8F, (byte)0xD3,
186+
(byte)0x8F, (byte)0xDD, (byte)0x90, (byte)0xE4,
187+
(byte)0x91, (byte)0x7E, (byte)0x91, (byte)0x89,
188+
(byte)0x91, (byte)0xCB, (byte)0x92, (byte)0x5C,
189+
(byte)0x92, (byte)0xCD, (byte)0x93, (byte)0x55,
190+
(byte)0x93, (byte)0x5E, (byte)0x93, (byte)0x98,
191+
(byte)0x93, (byte)0xC0, (byte)0x94, (byte)0x58,
192+
(byte)0x94, (byte)0x8D, (byte)0x94, (byte)0xAC,
193+
(byte)0x94, (byte)0xAE, (byte)0x96, (byte)0x6A,
194+
(byte)0x96, (byte)0xCB, (byte)0x97, (byte)0x89,
195+
(byte)0x98, (byte)0x58, (byte)0x9B, (byte)0xA0,
196+
(byte)0x9D, (byte)0xB7, (byte)0x9E, (byte)0x94,
197+
(byte)0xE3, (byte)0x79, (byte)0xE4, (byte)0x45,
198+
(byte)0xE8, (byte)0xF6, (byte)0xFA, (byte)0x55,
199+
(byte)0xFA, (byte)0x59,
200+
};
201+
202+
private static final String strIBM943c2b1 =
203+
"\u2015\uFF5E\u2225\uFF0D\u555E\u7130\u9DD7\u5699" +
204+
"\u4FE0\u8EC0\u7E6B\u8346\u9E7C\u9EB4\u6805\u5C62" +
205+
"\u7E61\u8523\u91AC\u87EC\u6414\u7626\u9A52\u7C1E" +
206+
"\u6451\u5861\u985A\u79B1\u7006\u56CA\u525D\u6F51" +
207+
"\u91B1\u9830\u9EB5\u840A\u881F\u5C5B\u6522\u688E" +
208+
"\u7E48\u8141\u9839\uFFE4\uF86F";
209+
210+
private static final String strIBM943c2b2 =
211+
"\u2014\u301C\u2016\u2212\u5516\u7114\u9D0E\u565B" +
212+
"\u4FA0\u8EAF\u7E4B\u834A\u9E78\u9EB9\u67F5\u5C61" +
213+
"\u7E4D\u848B\u91A4\u8749\u63BB\u75E9\u9A28\u7BAA" +
214+
"\u63B4\u586B\u985B\u7977\u6D9C\u56A2\u5265\u6E8C" +
215+
"\u9197\u982C\u9EBA\u83B1\u874B\u5C4F\u6505\u688D" +
216+
"\u7E66\u80FC\u983D\u00A6\u2116";
217+
218+
private static void bug8235834 () throws Exception {
219+
// 8235834 affects IBM-943 and IBM-943C encoder.
220+
// The decoded results of the corresponding characters of IBM-943
221+
// and IBM-943C is the same.
222+
for (String csName : new String[] {"x-IBM943", "x-IBM943C"}) {
223+
Charset cs = Charset.forName(csName);
224+
if (!Arrays.equals(byteIBM943c2b, strIBM943c2b1.getBytes(cs))) {
225+
throw new Exception(csName+" failed to encode");
226+
}
227+
if (!strIBM943c2b2.equals(new String(byteIBM943c2b, cs))) {
228+
throw new Exception(csName+" failed to round-trip conversion");
229+
}
230+
}
231+
}
175232
public static void main (String[] args) throws Exception {
176233
bug6577466();
177234
// need to be tested before any other IBM949C test case
@@ -182,5 +239,6 @@ public static void main (String[] args) throws Exception {
182239
bug6371619();
183240
bug6371431();
184241
bug6569191();
242+
bug8235834();
185243
}
186244
}

0 commit comments

Comments
 (0)