--- old/make/data/charsetmapping/MS950.nr 2020-03-03 02:11:53.617408019 +0900 +++ new/make/data/charsetmapping/MS950.nr 2020-03-03 02:11:53.387408019 +0900 @@ -12,7 +12,7 @@ 0xF9FD 0x256F 0xA2CC 0x5341 0xA2CE 0x5345 -0xF9F9 0x2550 -0xF9E9 0x255E -0xF9EA 0x256A -0xF9EB 0x2561 +0xA2A4 0x2550 +0xA2A5 0x255E +0xA2A6 0x256A +0xA2A7 0x2561 --- /dev/null 2020-02-10 10:55:16.047408019 +0900 +++ new/test/jdk/sun/nio/cs/TestMS950.java 2020-03-03 02:11:53.697408019 +0900 @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8232161 + * @summary Test MS950 charset + */ + +import java.nio.charset.Charset; +import java.util.Arrays; + +public class TestMS950 { + private static byte[][] data = new byte[][] { + { (byte)0xA2, (byte)0xA4, (byte)0xF9, (byte)0xF9, }, + { (byte)0xA2, (byte)0xA5, (byte)0xF9, (byte)0xE9, }, + { (byte)0xA2, (byte)0xA7, (byte)0xF9, (byte)0xEB, }, + { (byte)0xA2, (byte)0xA6, (byte)0xF9, (byte)0xEA, }, + { (byte)0xA2, (byte)0x7E, (byte)0xF9, (byte)0xFA, }, + { (byte)0xA2, (byte)0xA1, (byte)0xF9, (byte)0xFB, }, + { (byte)0xA2, (byte)0xA3, (byte)0xF9, (byte)0xFD, }, + { (byte)0xA2, (byte)0xA2, (byte)0xF9, (byte)0xFC, }, + { (byte)0xA2, (byte)0xCC, (byte)0xA4, (byte)0x51, }, + { (byte)0xA2, (byte)0xCE, (byte)0xA4, (byte)0xCA, }, + }; + + private static byte[][] expected = new byte[][] { + { (byte)0xF9, (byte)0xF9, (byte)0xF9, (byte)0xF9, }, + { (byte)0xF9, (byte)0xE9, (byte)0xF9, (byte)0xE9, }, + { (byte)0xF9, (byte)0xEB, (byte)0xF9, (byte)0xEB, }, + { (byte)0xF9, (byte)0xEA, (byte)0xF9, (byte)0xEA, }, + { (byte)0xA2, (byte)0x7E, (byte)0xA2, (byte)0x7E, }, + { (byte)0xA2, (byte)0xA1, (byte)0xA2, (byte)0xA1, }, + { (byte)0xA2, (byte)0xA3, (byte)0xA2, (byte)0xA3, }, + { (byte)0xA2, (byte)0xA2, (byte)0xA2, (byte)0xA2, }, + { (byte)0xA4, (byte)0x51, (byte)0xA4, (byte)0x51, }, + { (byte)0xA4, (byte)0xCA, (byte)0xA4, (byte)0xCA, }, + }; + + public static void main(String[] args) throws Exception { + Charset cs = Charset.forName("MS950"); + int diffs = 0; + for(int i = 0; i < data.length; ++i) { + String s = new String(data[i], cs); + byte[] result = s.getBytes(cs); + if (!Arrays.equals(expected[i], result)) { + ++diffs; + for (char ch : s.toCharArray()) { + System.out.printf("\\u%04X", (int)ch); + } + System.out.print(", expected: "); + for(byte b : expected[i]) { + System.out.printf("\\x%02X", (int)b & 0xFF); + } + System.out.print(", result: "); + for(byte b : result) { + System.out.printf("\\x%02X", (int)b & 0xFF); + } + System.out.println(); + } + } + if (diffs > 0) { + throw new Exception("Failed"); + } + } +}