796
|
1 |
/*
|
5506
|
2 |
* Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
|
796
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
*
|
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
|
7 |
* published by the Free Software Foundation.
|
|
8 |
*
|
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
13 |
* accompanied this code).
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License version
|
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
18 |
*
|
5506
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
20 |
* or visit www.oracle.com if you need additional information or have any
|
|
21 |
* questions.
|
796
|
22 |
*/
|
|
23 |
|
|
24 |
/* @test
|
|
25 |
@bug 4513767 4961027
|
|
26 |
@summary Checks canonical names match between old and (NIO) core charsets
|
|
27 |
*/
|
|
28 |
import java.io.InputStreamReader;
|
|
29 |
import java.io.IOException;
|
|
30 |
|
|
31 |
public class CheckHistoricalNames {
|
|
32 |
static int failed = 0;
|
|
33 |
public static void main (String[] args) throws Exception {
|
|
34 |
checkHistoricalName("ASCII");
|
|
35 |
checkHistoricalName("Cp1252");
|
|
36 |
checkHistoricalName("ISO8859_1");
|
|
37 |
checkHistoricalName("UnicodeBigUnmarked");
|
|
38 |
checkHistoricalName("UnicodeLittle");
|
|
39 |
checkHistoricalName("UnicodeLittleUnmarked");
|
|
40 |
checkHistoricalName("UTF8");
|
|
41 |
checkHistoricalName("UTF-16");
|
|
42 |
|
|
43 |
checkMappedName("UnicodeBig", "UTF-16");
|
|
44 |
checkMappedName("US-ASCII", "ASCII");
|
|
45 |
checkMappedName("ISO-8859-1", "ISO8859_1");
|
|
46 |
checkMappedName("UTF-8", "UTF8");
|
|
47 |
checkMappedName("UTF-16BE", "UnicodeBigUnmarked");
|
|
48 |
checkMappedName("UTF-16LE", "UnicodeLittleUnmarked");
|
|
49 |
|
|
50 |
checkHistoricalName("ISO8859_2");
|
|
51 |
checkHistoricalName("ISO8859_4");
|
|
52 |
checkHistoricalName("ISO8859_5");
|
|
53 |
checkHistoricalName("ISO8859_7");
|
|
54 |
checkHistoricalName("ISO8859_9");
|
|
55 |
checkHistoricalName("ISO8859_13");
|
|
56 |
checkHistoricalName("KOI8_R");
|
|
57 |
checkHistoricalName("Cp1250");
|
|
58 |
checkHistoricalName("Cp1251");
|
|
59 |
checkHistoricalName("Cp1253");
|
|
60 |
checkHistoricalName("Cp1254");
|
|
61 |
checkHistoricalName("Cp1257");
|
|
62 |
|
|
63 |
checkMappedName("ISO-8859-2", "ISO8859_2");
|
|
64 |
checkMappedName("ISO-8859-4", "ISO8859_4");
|
|
65 |
checkMappedName("ISO-8859-5", "ISO8859_5");
|
|
66 |
checkMappedName("ISO-8859-7", "ISO8859_7");
|
|
67 |
checkMappedName("ISO-8859-9", "ISO8859_9");
|
|
68 |
checkMappedName("ISO-8859-13", "ISO8859_13");
|
|
69 |
checkMappedName("KOI8-R", "KOI8_R");
|
|
70 |
checkMappedName("windows-1250", "Cp1250");
|
|
71 |
checkMappedName("windows-1251","Cp1251");
|
|
72 |
checkMappedName("windows-1253", "Cp1253");
|
|
73 |
checkMappedName("windows-1254", "Cp1254");
|
|
74 |
checkMappedName("windows-1257", "Cp1257");
|
|
75 |
|
|
76 |
checkHistoricalName("EUC_CN");
|
|
77 |
checkHistoricalName("EUC_JP");
|
|
78 |
checkHistoricalName("EUC_JP_LINUX");
|
|
79 |
checkHistoricalName("EUC_KR");
|
|
80 |
checkHistoricalName("EUC_TW");
|
|
81 |
checkHistoricalName("ISO2022CN");
|
|
82 |
checkHistoricalName("ISO2022JP");
|
|
83 |
checkHistoricalName("ISO2022KR");
|
|
84 |
checkHistoricalName("ISO8859_3");
|
|
85 |
checkHistoricalName("ISO8859_6");
|
|
86 |
checkHistoricalName("ISO8859_8");
|
|
87 |
checkHistoricalName("Cp1255");
|
|
88 |
checkHistoricalName("Cp1256");
|
|
89 |
checkHistoricalName("Cp1258");
|
|
90 |
checkHistoricalName("MS936");
|
|
91 |
checkHistoricalName("MS949");
|
|
92 |
checkHistoricalName("MS950");
|
|
93 |
checkHistoricalName("TIS620");
|
|
94 |
|
|
95 |
checkMappedName("EUC-CN", "EUC_CN");
|
|
96 |
checkMappedName("EUC-JP", "EUC_JP");
|
|
97 |
checkMappedName("EUC-JP-LINUX", "EUC_JP_LINUX");
|
|
98 |
checkMappedName("EUC-TW", "EUC_TW");
|
|
99 |
checkMappedName("EUC-KR", "EUC_KR");
|
|
100 |
checkMappedName("ISO-2022-CN", "ISO2022CN");
|
|
101 |
checkMappedName("ISO-2022-JP", "ISO2022JP");
|
|
102 |
checkMappedName("ISO-2022-KR", "ISO2022KR");
|
|
103 |
checkMappedName("ISO-8859-3", "ISO8859_3");
|
|
104 |
checkMappedName("ISO-8859-6", "ISO8859_6");
|
|
105 |
checkMappedName("ISO-8859-8", "ISO8859_8");
|
|
106 |
checkMappedName("windows-1255", "Cp1255");
|
|
107 |
checkMappedName("windows-1256", "Cp1256");
|
|
108 |
checkMappedName("windows-1258", "Cp1258");
|
|
109 |
checkMappedName("windows-936", "GBK");
|
|
110 |
checkMappedName("windows-949", "MS949");
|
|
111 |
checkMappedName("windows-950", "MS950");
|
|
112 |
checkMappedName("x-MS950-HKSCS", "MS950_HKSCS");
|
|
113 |
checkMappedName("x-PCK", "PCK");
|
|
114 |
checkMappedName("Shift_JIS", "SJIS");
|
|
115 |
checkMappedName("x-JISAutoDetect", "JISAutoDetect");
|
|
116 |
checkMappedName("TIS-620", "TIS620");
|
|
117 |
checkMappedName("x-Big5-Solaris", "Big5_Solaris");
|
|
118 |
|
|
119 |
checkHistoricalName("Cp037");
|
|
120 |
checkHistoricalName("Cp1006");
|
|
121 |
checkHistoricalName("Cp1025");
|
|
122 |
checkHistoricalName("Cp1026");
|
|
123 |
checkHistoricalName("Cp1046");
|
|
124 |
checkHistoricalName("Cp1047");
|
|
125 |
checkHistoricalName("Cp1097");
|
|
126 |
checkHistoricalName("Cp1098");
|
|
127 |
checkHistoricalName("Cp1112");
|
|
128 |
checkHistoricalName("Cp1122");
|
|
129 |
checkHistoricalName("Cp1123");
|
|
130 |
checkHistoricalName("Cp1124");
|
|
131 |
checkHistoricalName("Cp1140");
|
|
132 |
checkHistoricalName("Cp1141");
|
|
133 |
checkHistoricalName("Cp1142");
|
|
134 |
checkHistoricalName("Cp1143");
|
|
135 |
checkHistoricalName("Cp1144");
|
|
136 |
checkHistoricalName("Cp1145");
|
|
137 |
checkHistoricalName("Cp1146");
|
|
138 |
checkHistoricalName("Cp1147");
|
|
139 |
checkHistoricalName("Cp1148");
|
|
140 |
checkHistoricalName("Cp1149");
|
|
141 |
checkHistoricalName("Cp1381");
|
|
142 |
checkHistoricalName("Cp1383");
|
|
143 |
checkHistoricalName("Cp273");
|
|
144 |
checkHistoricalName("Cp277");
|
|
145 |
checkHistoricalName("Cp278");
|
|
146 |
checkHistoricalName("Cp280");
|
|
147 |
checkHistoricalName("Cp284");
|
|
148 |
checkHistoricalName("Cp285");
|
|
149 |
checkHistoricalName("Cp297");
|
|
150 |
checkHistoricalName("Cp33722");
|
|
151 |
checkHistoricalName("Cp420");
|
|
152 |
checkHistoricalName("Cp424");
|
|
153 |
checkHistoricalName("Cp437");
|
|
154 |
checkHistoricalName("Cp500");
|
|
155 |
checkHistoricalName("Cp737");
|
|
156 |
checkHistoricalName("Cp775");
|
|
157 |
checkHistoricalName("Cp838");
|
|
158 |
checkHistoricalName("Cp850");
|
|
159 |
checkHistoricalName("Cp852");
|
|
160 |
checkHistoricalName("Cp855");
|
|
161 |
checkHistoricalName("Cp856");
|
|
162 |
checkHistoricalName("Cp857");
|
|
163 |
checkHistoricalName("Cp858");
|
|
164 |
checkHistoricalName("Cp860");
|
|
165 |
checkHistoricalName("Cp861");
|
|
166 |
checkHistoricalName("Cp862");
|
|
167 |
checkHistoricalName("Cp863");
|
|
168 |
checkHistoricalName("Cp864");
|
|
169 |
checkHistoricalName("Cp865");
|
|
170 |
checkHistoricalName("Cp866");
|
|
171 |
checkHistoricalName("Cp868");
|
|
172 |
checkHistoricalName("Cp869");
|
|
173 |
checkHistoricalName("Cp870");
|
|
174 |
checkHistoricalName("Cp871");
|
|
175 |
checkHistoricalName("Cp874");
|
|
176 |
checkHistoricalName("Cp875");
|
|
177 |
checkHistoricalName("Cp918");
|
|
178 |
checkHistoricalName("Cp921");
|
|
179 |
checkHistoricalName("Cp922");
|
|
180 |
checkHistoricalName("Cp933");
|
|
181 |
checkHistoricalName("Cp939");
|
|
182 |
checkHistoricalName("Cp949");
|
|
183 |
checkHistoricalName("Cp964");
|
|
184 |
checkHistoricalName("Cp970");
|
|
185 |
|
|
186 |
checkMappedName("IBM037", "Cp037");
|
|
187 |
checkMappedName("IBM1006", "Cp1006");
|
|
188 |
checkMappedName("IBM1025", "Cp1025");
|
|
189 |
checkMappedName("IBM1026", "Cp1026");
|
|
190 |
checkMappedName("x-IBM1046", "Cp1046");
|
|
191 |
checkMappedName("IBM1047", "Cp1047");
|
|
192 |
checkMappedName("IBM1097", "Cp1097");
|
|
193 |
checkMappedName("IBM1098", "Cp1098");
|
|
194 |
checkMappedName("IBM1112", "Cp1112");
|
|
195 |
checkMappedName("IBM1122", "Cp1122");
|
|
196 |
checkMappedName("IBM1123", "Cp1123");
|
|
197 |
checkMappedName("IBM1124", "Cp1124");
|
|
198 |
checkMappedName("IBM01140", "Cp1140");
|
|
199 |
checkMappedName("IBM01141", "Cp1141");
|
|
200 |
checkMappedName("IBM01142", "Cp1142");
|
|
201 |
checkMappedName("IBM01143", "Cp1143");
|
|
202 |
checkMappedName("IBM01144", "Cp1144");
|
|
203 |
checkMappedName("IBM01145", "Cp1145");
|
|
204 |
checkMappedName("IBM01146", "Cp1146");
|
|
205 |
checkMappedName("IBM01147", "Cp1147");
|
|
206 |
checkMappedName("IBM01148", "Cp1148");
|
|
207 |
checkMappedName("IBM01149", "Cp1149");
|
|
208 |
checkMappedName("IBM1381", "Cp1381");
|
|
209 |
checkMappedName("IBM1383", "Cp1383");
|
|
210 |
checkMappedName("IBM273", "Cp273");
|
|
211 |
checkMappedName("IBM277", "Cp277");
|
|
212 |
checkMappedName("IBM278", "Cp278");
|
|
213 |
checkMappedName("IBM280", "Cp280");
|
|
214 |
checkMappedName("IBM284", "Cp284");
|
|
215 |
checkMappedName("IBM285", "Cp285");
|
|
216 |
checkMappedName("IBM297", "Cp297");
|
|
217 |
checkMappedName("IBM33722", "Cp33722");
|
|
218 |
checkMappedName("IBM420", "Cp420");
|
|
219 |
checkMappedName("IBM424", "Cp424");
|
|
220 |
checkMappedName("IBM437", "Cp437");
|
|
221 |
checkMappedName("IBM500", "Cp500");
|
|
222 |
checkMappedName("IBM737", "Cp737");
|
|
223 |
checkMappedName("IBM775", "Cp775");
|
|
224 |
checkMappedName("IBM838", "Cp838");
|
|
225 |
checkMappedName("IBM850", "Cp850");
|
|
226 |
checkMappedName("IBM852", "Cp852");
|
|
227 |
checkMappedName("IBM855", "Cp855");
|
|
228 |
checkMappedName("IBM856", "Cp856");
|
|
229 |
checkMappedName("IBM857", "Cp857");
|
|
230 |
checkMappedName("IBM00858", "Cp858");
|
|
231 |
checkMappedName("IBM860", "Cp860");
|
|
232 |
checkMappedName("IBM861", "Cp861");
|
|
233 |
checkMappedName("IBM862", "Cp862");
|
|
234 |
checkMappedName("IBM863", "Cp863");
|
|
235 |
checkMappedName("IBM864", "Cp864");
|
|
236 |
checkMappedName("IBM865", "Cp865");
|
|
237 |
checkMappedName("IBM866", "Cp866");
|
|
238 |
checkMappedName("IBM868", "Cp868");
|
|
239 |
checkMappedName("IBM869", "Cp869");
|
|
240 |
checkMappedName("IBM870", "Cp870");
|
|
241 |
checkMappedName("IBM871", "Cp871");
|
|
242 |
checkMappedName("IBM874", "Cp874");
|
|
243 |
checkMappedName("IBM875", "Cp875");
|
|
244 |
checkMappedName("IBM918", "Cp918");
|
|
245 |
checkMappedName("IBM921", "Cp921");
|
|
246 |
checkMappedName("IBM922", "Cp922");
|
|
247 |
checkMappedName("x-IBM930", "Cp930");
|
|
248 |
checkMappedName("IBM933", "Cp933");
|
|
249 |
checkMappedName("x-IBM935", "Cp935");
|
|
250 |
checkMappedName("x-IBM937", "Cp937");
|
|
251 |
checkMappedName("IBM939", "Cp939");
|
|
252 |
checkMappedName("x-IBM942", "Cp942");
|
|
253 |
checkMappedName("x-IBM942C", "Cp942C");
|
|
254 |
checkMappedName("x-IBM943", "Cp943");
|
|
255 |
checkMappedName("x-IBM943C", "Cp943C");
|
|
256 |
checkMappedName("x-IBM948", "Cp948");
|
|
257 |
checkMappedName("IBM949", "Cp949");
|
|
258 |
checkMappedName("x-IBM949C", "Cp949C");
|
|
259 |
checkMappedName("x-IBM950", "Cp950");
|
|
260 |
checkMappedName("IBM964", "Cp964");
|
|
261 |
checkMappedName("IBM970", "Cp970");
|
|
262 |
|
|
263 |
checkHistoricalName("MacArabic");
|
|
264 |
checkHistoricalName("MacCentralEurope");
|
|
265 |
checkHistoricalName("MacCroatian");
|
|
266 |
checkHistoricalName("MacCyrillic");
|
|
267 |
checkHistoricalName("MacDingbat");
|
|
268 |
checkHistoricalName("MacGreek");
|
|
269 |
checkHistoricalName("MacHebrew");
|
|
270 |
checkHistoricalName("MacIceland");
|
|
271 |
checkHistoricalName("MacRoman");
|
|
272 |
checkHistoricalName("MacRomania");
|
|
273 |
checkHistoricalName("MacSymbol");
|
|
274 |
checkHistoricalName("MacThai");
|
|
275 |
checkHistoricalName("MacTurkish");
|
|
276 |
checkHistoricalName("MacUkraine");
|
|
277 |
|
|
278 |
checkMappedName("x-MacArabic", "MacArabic");
|
|
279 |
checkMappedName("x-MacCentralEurope", "MacCentralEurope");
|
|
280 |
checkMappedName("x-MacCroatian", "MacCroatian");
|
|
281 |
checkMappedName("x-MacCyrillic", "MacCyrillic");
|
|
282 |
checkMappedName("x-MacDingbat", "MacDingbat");
|
|
283 |
checkMappedName("x-MacGreek", "MacGreek");
|
|
284 |
checkMappedName("x-MacHebrew", "MacHebrew");
|
|
285 |
checkMappedName("x-MacIceland", "MacIceland");
|
|
286 |
checkMappedName("x-MacRoman", "MacRoman");
|
|
287 |
checkMappedName("x-MacRomania", "MacRomania");
|
|
288 |
checkMappedName("x-MacSymbol", "MacSymbol");
|
|
289 |
checkMappedName("x-MacThai", "MacThai");
|
|
290 |
checkMappedName("x-MacTurkish", "MacTurkish");
|
|
291 |
checkMappedName("x-MacUkraine", "MacUkraine");
|
|
292 |
|
|
293 |
if (failed != 0)
|
|
294 |
throw new Exception("Test Failed: " + failed);
|
|
295 |
else
|
|
296 |
System.out.println("Test Passed!");
|
|
297 |
}
|
|
298 |
|
|
299 |
private static void checkHistoricalName(String name) throws Exception {
|
|
300 |
checkMappedName(name, name);
|
|
301 |
}
|
|
302 |
|
|
303 |
private static void checkMappedName(String alias, String canonical)
|
|
304 |
throws Exception {
|
|
305 |
InputStreamReader reader = new InputStreamReader(System.in, alias);
|
|
306 |
if (!reader.getEncoding().equals(canonical)) {
|
|
307 |
System.out.println("Failed canonical names : mismatch for " + alias
|
|
308 |
+ " - expected " + canonical
|
|
309 |
+ ", got " + reader.getEncoding());
|
|
310 |
failed++;
|
|
311 |
}
|
|
312 |
}
|
|
313 |
}
|