From 217aa23c5ca40c3cf8f06903824760017bd3b3ec Mon Sep 17 00:00:00 2001 From: sherman Date: Wed, 17 Nov 2010 21:33:16 -0800 Subject: [PATCH] 6217210: RFE: Support for Cp833 in 1.4.2 Summary: Forward port the Cp833 charset Reviewed-by: poonam --- make/sun/nio/cs/FILES_java.gmk | 3 + make/tools/CharsetMapping/IBM833.c2b | 94 ++++++++ make/tools/CharsetMapping/IBM833.map | 217 ++++++++++++++++++ make/tools/CharsetMapping/extsbcs | 1 + src/share/classes/sun/io/ByteToCharCp833.java | 42 ++++ src/share/classes/sun/io/CharToByteCp833.java | 46 ++++ .../classes/sun/io/CharacterEncoding.java | 7 +- .../sun/nio/cs/ext/ExtendedCharsets.java | 7 + test/sun/nio/cs/CheckHistoricalNames.java | 4 +- 9 files changed, 419 insertions(+), 2 deletions(-) create mode 100644 make/tools/CharsetMapping/IBM833.c2b create mode 100644 make/tools/CharsetMapping/IBM833.map create mode 100644 src/share/classes/sun/io/ByteToCharCp833.java create mode 100644 src/share/classes/sun/io/CharToByteCp833.java diff --git a/make/sun/nio/cs/FILES_java.gmk b/make/sun/nio/cs/FILES_java.gmk index d930065d8..b177d64b4 100644 --- a/make/sun/nio/cs/FILES_java.gmk +++ b/make/sun/nio/cs/FILES_java.gmk @@ -85,6 +85,7 @@ FILES_src = \ sun/io/ByteToCharCp500.java \ sun/io/ByteToCharCp737.java \ sun/io/ByteToCharCp775.java \ + sun/io/ByteToCharCp833.java \ sun/io/ByteToCharCp834.java \ sun/io/ByteToCharCp838.java \ sun/io/ByteToCharCp850.java \ @@ -214,6 +215,7 @@ FILES_src = \ sun/io/CharToByteCp500.java \ sun/io/CharToByteCp737.java \ sun/io/CharToByteCp775.java \ + sun/io/CharToByteCp833.java \ sun/io/CharToByteCp834.java \ sun/io/CharToByteCp838.java \ sun/io/CharToByteCp850.java \ @@ -331,6 +333,7 @@ FILES_gen_extcs = \ sun/nio/cs/ext/IBM420.java \ sun/nio/cs/ext/IBM424.java \ sun/nio/cs/ext/IBM500.java \ + sun/nio/cs/ext/IBM833.java \ sun/nio/cs/ext/IBM838.java \ sun/nio/cs/ext/IBM856.java \ sun/nio/cs/ext/IBM860.java \ diff --git a/make/tools/CharsetMapping/IBM833.c2b b/make/tools/CharsetMapping/IBM833.c2b new file mode 100644 index 000000000..b751d80bc --- /dev/null +++ b/make/tools/CharsetMapping/IBM833.c2b @@ -0,0 +1,94 @@ +0x5A U+FF01 +0x7F U+FF02 +0x7B U+FF03 +0x5B U+FF04 +0x6C U+FF05 +0x50 U+FF06 +0x7D U+FF07 +0x4D U+FF08 +0x5D U+FF09 +0x5C U+FF0A +0x4E U+FF0B +0x6B U+FF0C +0x60 U+FF0D +0x4B U+FF0E +0x61 U+FF0F +0xF0 U+FF10 +0xF1 U+FF11 +0xF2 U+FF12 +0xF3 U+FF13 +0xF4 U+FF14 +0xF5 U+FF15 +0xF6 U+FF16 +0xF7 U+FF17 +0xF8 U+FF18 +0xF9 U+FF19 +0x7A U+FF1A +0x5E U+FF1B +0x4C U+FF1C +0x7E U+FF1D +0x6E U+FF1E +0x6F U+FF1F +0x7C U+FF20 +0xC1 U+FF21 +0xC2 U+FF22 +0xC3 U+FF23 +0xC4 U+FF24 +0xC5 U+FF25 +0xC6 U+FF26 +0xC7 U+FF27 +0xC8 U+FF28 +0xC9 U+FF29 +0xD1 U+FF2A +0xD2 U+FF2B +0xD3 U+FF2C +0xD4 U+FF2D +0xD5 U+FF2E +0xD6 U+FF2F +0xD7 U+FF30 +0xD8 U+FF31 +0xD9 U+FF32 +0xE2 U+FF33 +0xE3 U+FF34 +0xE4 U+FF35 +0xE5 U+FF36 +0xE6 U+FF37 +0xE7 U+FF38 +0xE8 U+FF39 +0xE9 U+FF3A +0x70 U+FF3B +0xB2 U+FF3C +0x80 U+FF3D +0xB0 U+FF3E +0x6D U+FF3F +0x79 U+FF40 +0x81 U+FF41 +0x82 U+FF42 +0x83 U+FF43 +0x84 U+FF44 +0x85 U+FF45 +0x86 U+FF46 +0x87 U+FF47 +0x88 U+FF48 +0x89 U+FF49 +0x91 U+FF4A +0x92 U+FF4B +0x93 U+FF4C +0x94 U+FF4D +0x95 U+FF4E +0x96 U+FF4F +0x97 U+FF50 +0x98 U+FF51 +0x99 U+FF52 +0xA2 U+FF53 +0xA3 U+FF54 +0xA4 U+FF55 +0xA5 U+FF56 +0xA6 U+FF57 +0xA7 U+FF58 +0xA8 U+FF59 +0xA9 U+FF5A +0xC0 U+FF5B +0x4F U+FF5C +0xD0 U+FF5D +0xA1 U+FF5E diff --git a/make/tools/CharsetMapping/IBM833.map b/make/tools/CharsetMapping/IBM833.map new file mode 100644 index 000000000..b36860ae4 --- /dev/null +++ b/make/tools/CharsetMapping/IBM833.map @@ -0,0 +1,217 @@ +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x37 U+0004 +0x2D U+0005 +0x2E U+0006 +0x2F U+0007 +0x16 U+0008 +0x05 U+0009 +0x25 U+000A +0x0B U+000B +0x0C U+000C +0x0D U+000D +0x0E U+000E +0x0F U+000F +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x3C U+0014 +0x3D U+0015 +0x32 U+0016 +0x26 U+0017 +0x18 U+0018 +0x19 U+0019 +0x3F U+001A +0x27 U+001B +0x1C U+001C +0x1D U+001D +0x1E U+001E +0x1F U+001F +0x40 U+0020 +0x5A U+0021 +0x7F U+0022 +0x7B U+0023 +0x5B U+0024 +0x6C U+0025 +0x50 U+0026 +0x7D U+0027 +0x4D U+0028 +0x5D U+0029 +0x5C U+002A +0x4E U+002B +0x6B U+002C +0x60 U+002D +0x4B U+002E +0x61 U+002F +0xF0 U+0030 +0xF1 U+0031 +0xF2 U+0032 +0xF3 U+0033 +0xF4 U+0034 +0xF5 U+0035 +0xF6 U+0036 +0xF7 U+0037 +0xF8 U+0038 +0xF9 U+0039 +0x7A U+003A +0x5E U+003B +0x4C U+003C +0x7E U+003D +0x6E U+003E +0x6F U+003F +0x7C U+0040 +0xC1 U+0041 +0xC2 U+0042 +0xC3 U+0043 +0xC4 U+0044 +0xC5 U+0045 +0xC6 U+0046 +0xC7 U+0047 +0xC8 U+0048 +0xC9 U+0049 +0xD1 U+004A +0xD2 U+004B +0xD3 U+004C +0xD4 U+004D +0xD5 U+004E +0xD6 U+004F +0xD7 U+0050 +0xD8 U+0051 +0xD9 U+0052 +0xE2 U+0053 +0xE3 U+0054 +0xE4 U+0055 +0xE5 U+0056 +0xE6 U+0057 +0xE7 U+0058 +0xE8 U+0059 +0xE9 U+005A +0x70 U+005B +0xB2 U+005C +0x80 U+005D +0xB0 U+005E +0x6D U+005F +0x79 U+0060 +0x81 U+0061 +0x82 U+0062 +0x83 U+0063 +0x84 U+0064 +0x85 U+0065 +0x86 U+0066 +0x87 U+0067 +0x88 U+0068 +0x89 U+0069 +0x91 U+006A +0x92 U+006B +0x93 U+006C +0x94 U+006D +0x95 U+006E +0x96 U+006F +0x97 U+0070 +0x98 U+0071 +0x99 U+0072 +0xA2 U+0073 +0xA3 U+0074 +0xA4 U+0075 +0xA5 U+0076 +0xA6 U+0077 +0xA7 U+0078 +0xA8 U+0079 +0xA9 U+007A +0xC0 U+007B +0x4F U+007C +0xD0 U+007D +0xA1 U+007E +0x07 U+007F +0x20 U+0080 +0x21 U+0081 +0x22 U+0082 +0x23 U+0083 +0x24 U+0084 +0x15 U+0085 +0x06 U+0086 +0x17 U+0087 +0x28 U+0088 +0x29 U+0089 +0x2A U+008A +0x2B U+008B +0x2C U+008C +0x09 U+008D +0x0A U+008E +0x1B U+008F +0x30 U+0090 +0x31 U+0091 +0x1A U+0092 +0x33 U+0093 +0x34 U+0094 +0x35 U+0095 +0x36 U+0096 +0x08 U+0097 +0x38 U+0098 +0x39 U+0099 +0x3A U+009A +0x3B U+009B +0x04 U+009C +0x14 U+009D +0x3E U+009E +0xFF U+009F +0x4A U+00A2 +0x6A U+00A6 +0x5F U+00AC +0xA0 U+203E +0xE0 U+20A9 +0x42 U+FFA0 +0x43 U+FFA1 +0x44 U+FFA2 +0x45 U+FFA3 +0x46 U+FFA4 +0x47 U+FFA5 +0x48 U+FFA6 +0x49 U+FFA7 +0x52 U+FFA8 +0x53 U+FFA9 +0x54 U+FFAA +0x55 U+FFAB +0x56 U+FFAC +0x57 U+FFAD +0x58 U+FFAE +0x59 U+FFAF +0x62 U+FFB0 +0x63 U+FFB1 +0x64 U+FFB2 +0x65 U+FFB3 +0x66 U+FFB4 +0x67 U+FFB5 +0x68 U+FFB6 +0x69 U+FFB7 +0x72 U+FFB8 +0x73 U+FFB9 +0x74 U+FFBA +0x75 U+FFBB +0x76 U+FFBC +0x77 U+FFBD +0x78 U+FFBE +0x8A U+FFC2 +0x8B U+FFC3 +0x8C U+FFC4 +0x8D U+FFC5 +0x8E U+FFC6 +0x8F U+FFC7 +0x9A U+FFCA +0x9B U+FFCB +0x9C U+FFCC +0x9D U+FFCD +0x9E U+FFCE +0x9F U+FFCF +0xAA U+FFD2 +0xAB U+FFD3 +0xAC U+FFD4 +0xAD U+FFD5 +0xAE U+FFD6 +0xAF U+FFD7 +0xBA U+FFDA +0xBB U+FFDB +0xBC U+FFDC diff --git a/make/tools/CharsetMapping/extsbcs b/make/tools/CharsetMapping/extsbcs index 81a6acdf8..e66fe5bbb 100644 --- a/make/tools/CharsetMapping/extsbcs +++ b/make/tools/CharsetMapping/extsbcs @@ -32,6 +32,7 @@ IBM297 IBM297 Cp297 false sun.nio.cs.ext IBM420 IBM420 Cp420 false sun.nio.cs.ext IBM424 IBM424 Cp424 false sun.nio.cs.ext IBM500 IBM500 Cp500 false sun.nio.cs.ext +IBM833 IBM833 Cp833 false sun.nio.cs.ext IBM838 IBM-Thai Cp838 false sun.nio.cs.ext IBM856 x-IBM856 Cp856 false sun.nio.cs.ext IBM860 IBM860 Cp860 false sun.nio.cs.ext diff --git a/src/share/classes/sun/io/ByteToCharCp833.java b/src/share/classes/sun/io/ByteToCharCp833.java new file mode 100644 index 000000000..a83a893d1 --- /dev/null +++ b/src/share/classes/sun/io/ByteToCharCp833.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2010 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ + +package sun.io; + +import sun.nio.cs.ext.IBM833; + +public class ByteToCharCp833 extends ByteToCharSingleByte { + + private final static IBM833 nioCoder = new IBM833(); + + public String getCharacterEncoding() { + return "Cp833"; + } + + public ByteToCharCp833() { + super.byteToCharTable = nioCoder.getDecoderSingleByteMappings(); + } +} + diff --git a/src/share/classes/sun/io/CharToByteCp833.java b/src/share/classes/sun/io/CharToByteCp833.java new file mode 100644 index 000000000..2d531406c --- /dev/null +++ b/src/share/classes/sun/io/CharToByteCp833.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2010 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. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * 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. + */ + +package sun.io; + +import sun.nio.cs.ext.IBM833; + +public class CharToByteCp833 extends CharToByteSingleByte { + + private final static IBM833 nioCoder = new IBM833(); + + public String getCharacterEncoding() { + return "Cp833"; + } + + public CharToByteCp833() { + super.mask1 = 0xFF00; + super.mask2 = 0x00FF; + super.shift = 8; + super.index1 = nioCoder.getEncoderIndex1(); + super.index2 = nioCoder.getEncoderIndex2(); + } +} + diff --git a/src/share/classes/sun/io/CharacterEncoding.java b/src/share/classes/sun/io/CharacterEncoding.java index 94ce7040f..f577a9bc7 100644 --- a/src/share/classes/sun/io/CharacterEncoding.java +++ b/src/share/classes/sun/io/CharacterEncoding.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2010, 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 @@ -406,6 +406,11 @@ public class CharacterEncoding { aliasTable.put("cp775", "Cp775"); aliasTable.put("775", "Cp775"); + aliasTable.put("ibm833", "Cp833"); + aliasTable.put("ibm-833", "Cp833"); + aliasTable.put("cp833", "Cp833"); + aliasTable.put("833", "Cp833"); + aliasTable.put("ibm834", "Cp834"); aliasTable.put("ibm-834", "Cp834"); aliasTable.put("cp834", "Cp834"); diff --git a/src/share/classes/sun/nio/cs/ext/ExtendedCharsets.java b/src/share/classes/sun/nio/cs/ext/ExtendedCharsets.java index ca6a49637..920e3372d 100644 --- a/src/share/classes/sun/nio/cs/ext/ExtendedCharsets.java +++ b/src/share/classes/sun/nio/cs/ext/ExtendedCharsets.java @@ -778,6 +778,13 @@ public class ExtendedCharsets "csIBM500" }); + charset("x-IBM833", "IBM833", + new String[] { + "cp833", + "ibm833", + "ibm-833" + }); + //EBCDIC DBCS-only Korean charset("x-IBM834", "IBM834", new String[] { diff --git a/test/sun/nio/cs/CheckHistoricalNames.java b/test/sun/nio/cs/CheckHistoricalNames.java index fdab32d75..af04434bd 100644 --- a/test/sun/nio/cs/CheckHistoricalNames.java +++ b/test/sun/nio/cs/CheckHistoricalNames.java @@ -22,7 +22,7 @@ */ /* @test - @bug 4513767 4961027 + @bug 4513767 4961027 6217210 @summary Checks canonical names match between old and (NIO) core charsets */ import java.io.InputStreamReader; @@ -154,6 +154,7 @@ public class CheckHistoricalNames { checkHistoricalName("Cp500"); checkHistoricalName("Cp737"); checkHistoricalName("Cp775"); + checkHistoricalName("Cp833"); checkHistoricalName("Cp838"); checkHistoricalName("Cp850"); checkHistoricalName("Cp852"); @@ -228,6 +229,7 @@ public class CheckHistoricalNames { checkMappedName("IBM856", "Cp856"); checkMappedName("IBM857", "Cp857"); checkMappedName("IBM00858", "Cp858"); + checkMappedName("IBM833", "Cp833"); checkMappedName("IBM860", "Cp860"); checkMappedName("IBM861", "Cp861"); checkMappedName("IBM862", "Cp862"); -- GitLab