001: /*
002: * @(#)CharacterEncoding.java 1.54 06/10/10
003: *
004: * Copyright 1990-2006 Sun Microsystems, Inc. All Rights Reserved.
005: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
006: *
007: * This program is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU General Public License version
009: * 2 only, as published by the Free Software Foundation.
010: *
011: * This program is distributed in the hope that it will be useful, but
012: * WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * General Public License version 2 for more details (a copy is
015: * included at /legal/license.txt).
016: *
017: * You should have received a copy of the GNU General Public License
018: * version 2 along with this work; if not, write to the Free Software
019: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA
021: *
022: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
023: * Clara, CA 95054 or visit www.sun.com if you need additional
024: * information or have any questions.
025: *
026: */
027:
028: package sun.io;
029:
030: import java.util.Collections;
031: import java.util.HashMap;
032: import java.util.Locale;
033: import java.util.Map;
034: import java.security.AccessController;
035: import sun.security.action.GetPropertyAction;
036:
037: /*
038: * This class is public in sun.io, so other sun.* packages (such as
039: * HotJava) can use it, without exposing it to java.*.
040: * Translates IANA encoding name to the string which is the part of
041: * converter class.
042: */
043: public class CharacterEncoding {
044:
045: private static boolean sjisIsMS932;
046:
047: private static Map aliasTable;
048:
049: static {
050: aliasTable = new HashMap(460, 1.0f); /* MDA */
051:
052: aliasTable.put("us-ascii", "ASCII");
053: aliasTable.put("ascii", "ASCII");
054: aliasTable.put("646", "ASCII"); // Solaris POSIX locale
055: aliasTable.put("iso_646.irv:1983", "ASCII"); // Linux POSIX locale
056: aliasTable.put("ansi_x3.4-1968", "ASCII"); // Caldera linux
057: aliasTable.put("iso646-us", "ASCII");
058: aliasTable.put("default", "ASCII"); // compatibility with obsolete "Default" converters
059: aliasTable.put("ascii7", "ASCII"); // compatibility with obsolete "Default" converters
060:
061: // MIBenum: 4
062: aliasTable.put("8859_1", "ISO8859_1");
063: aliasTable.put("iso_8859-1:1987", "ISO8859_1");
064: aliasTable.put("iso-ir-100", "ISO8859_1");
065: aliasTable.put("iso_8859-1", "ISO8859_1");
066: aliasTable.put("iso-8859-1", "ISO8859_1");
067:
068: // Standard encodings used on Solaris and Linux
069: aliasTable.put("iso8859-1", "ISO8859_1");
070: aliasTable.put("latin1", "ISO8859_1");
071: aliasTable.put("l1", "ISO8859_1");
072: aliasTable.put("ibm819", "ISO8859_1");
073: aliasTable.put("ibm-819", "ISO8859_1");
074: aliasTable.put("cp819", "ISO8859_1");
075: aliasTable.put("819", "ISO8859_1");
076: aliasTable.put("csisolatin1", "ISO8859_1");
077:
078: // MIBenum: 5
079: aliasTable.put("8859_2", "ISO8859_2");
080: aliasTable.put("iso_8859-2:1987", "ISO8859_2");
081: aliasTable.put("iso-ir-101", "ISO8859_2");
082: aliasTable.put("iso_8859-2", "ISO8859_2");
083: aliasTable.put("iso-8859-2", "ISO8859_2");
084: aliasTable.put("iso8859-2", "ISO8859_2");
085: aliasTable.put("latin2", "ISO8859_2");
086: aliasTable.put("l2", "ISO8859_2");
087: aliasTable.put("ibm912", "ISO8859_2");
088: aliasTable.put("ibm-912", "ISO8859_2");
089: aliasTable.put("cp912", "ISO8859_2");
090: aliasTable.put("912", "ISO8859_2");
091: aliasTable.put("csisolatin2", "ISO8859_2");
092:
093: // MIBenum: 6
094: aliasTable.put("8859_3", "ISO8859_3");
095: aliasTable.put("iso_8859-3:1988", "ISO8859_3");
096: aliasTable.put("iso-ir-109", "ISO8859_3");
097: aliasTable.put("iso_8859-3", "ISO8859_3");
098: aliasTable.put("iso-8859-3", "ISO8859_3");
099: aliasTable.put("iso8859-3", "ISO8859_3");
100: aliasTable.put("latin3", "ISO8859_3");
101: aliasTable.put("l3", "ISO8859_3");
102: aliasTable.put("ibm913", "ISO8859_3");
103: aliasTable.put("ibm-913", "ISO8859_3");
104: aliasTable.put("cp913", "ISO8859_3");
105: aliasTable.put("913", "ISO8859_3");
106: aliasTable.put("csisolatin3", "ISO8859_3");
107:
108: // MIBenum: 7
109: aliasTable.put("8859_4", "ISO8859_4");
110: aliasTable.put("iso_8859-4:1988", "ISO8859_4");
111: aliasTable.put("iso-ir-110", "ISO8859_4");
112: aliasTable.put("iso_8859-4", "ISO8859_4");
113: aliasTable.put("iso-8859-4", "ISO8859_4");
114: aliasTable.put("iso8859-4", "ISO8859_4");
115: aliasTable.put("latin4", "ISO8859_4");
116: aliasTable.put("l4", "ISO8859_4");
117: aliasTable.put("ibm914", "ISO8859_4");
118: aliasTable.put("ibm-914", "ISO8859_4");
119: aliasTable.put("cp914", "ISO8859_4");
120: aliasTable.put("914", "ISO8859_4");
121: aliasTable.put("csisolatin4", "ISO8859_4");
122:
123: // MIBenum: 8
124: aliasTable.put("8859_5", "ISO8859_5");
125: aliasTable.put("iso_8859-5:1988", "ISO8859_5");
126: aliasTable.put("iso-ir-144", "ISO8859_5");
127: aliasTable.put("iso_8859-5", "ISO8859_5");
128: aliasTable.put("iso-8859-5", "ISO8859_5");
129: aliasTable.put("iso8859-5", "ISO8859_5");
130: aliasTable.put("cyrillic", "ISO8859_5");
131: aliasTable.put("csisolatincyrillic", "ISO8859_5");
132: aliasTable.put("ibm915", "ISO8859_5");
133: aliasTable.put("ibm-915", "ISO8859_5");
134: aliasTable.put("cp915", "ISO8859_5");
135: aliasTable.put("915", "ISO8859_5");
136:
137: // MIBenum: 9
138: aliasTable.put("8859_6", "ISO8859_6");
139: aliasTable.put("iso_8859-6:1987", "ISO8859_6");
140: aliasTable.put("iso-ir-127", "ISO8859_6");
141: aliasTable.put("iso_8859-6", "ISO8859_6");
142: aliasTable.put("iso-8859-6", "ISO8859_6");
143: aliasTable.put("iso8859-6", "ISO8859_6");
144: aliasTable.put("ecma-114", "ISO8859_6");
145: aliasTable.put("asmo-708", "ISO8859_6");
146: aliasTable.put("arabic", "ISO8859_6");
147: aliasTable.put("csisolatinarabic", "ISO8859_6");
148: aliasTable.put("ibm1089", "ISO8859_6");
149: aliasTable.put("ibm-1089", "ISO8859_6");
150: aliasTable.put("cp1089", "ISO8859_6");
151: aliasTable.put("1089", "ISO8859_6");
152:
153: // MIBenum: 10
154: aliasTable.put("8859_7", "ISO8859_7");
155: aliasTable.put("iso_8859-7:1987", "ISO8859_7");
156: aliasTable.put("iso-ir-126", "ISO8859_7");
157: aliasTable.put("iso_8859-7", "ISO8859_7");
158: aliasTable.put("iso-8859-7", "ISO8859_7");
159: aliasTable.put("iso8859-7", "ISO8859_7");
160: aliasTable.put("elot_928", "ISO8859_7");
161: aliasTable.put("ecma-118", "ISO8859_7");
162: aliasTable.put("greek", "ISO8859_7");
163: aliasTable.put("greek8", "ISO8859_7");
164: aliasTable.put("csisolatingreek", "ISO8859_7");
165: aliasTable.put("ibm813", "ISO8859_7");
166: aliasTable.put("ibm-813", "ISO8859_7");
167: aliasTable.put("cp813", "ISO8859_7");
168: aliasTable.put("813", "ISO8859_7");
169:
170: // MIBenum: 11
171: aliasTable.put("8859_8", "ISO8859_8");
172: aliasTable.put("iso_8859-8:1988", "ISO8859_8");
173: aliasTable.put("iso-ir-138", "ISO8859_8");
174: aliasTable.put("iso_8859-8", "ISO8859_8");
175: aliasTable.put("iso-8859-8", "ISO8859_8");
176: aliasTable.put("iso8859-8", "ISO8859_8");
177: aliasTable.put("hebrew", "ISO8859_8");
178: aliasTable.put("csisolatinhebrew", "ISO8859_8");
179: aliasTable.put("ibm916", "ISO8859_8");
180: aliasTable.put("ibm-916", "ISO8859_8");
181: aliasTable.put("cp916", "ISO8859_8");
182: aliasTable.put("916", "ISO8859_8");
183:
184: // MIBenum: 12
185: aliasTable.put("8859_9", "ISO8859_9");
186: aliasTable.put("iso-ir-148", "ISO8859_9");
187: aliasTable.put("iso_8859-9", "ISO8859_9");
188: aliasTable.put("iso-8859-9", "ISO8859_9");
189: aliasTable.put("iso8859-9", "ISO8859_9");
190: aliasTable.put("latin5", "ISO8859_9");
191: aliasTable.put("l5", "ISO8859_9");
192: aliasTable.put("ibm920", "ISO8859_9");
193: aliasTable.put("ibm-920", "ISO8859_9");
194: aliasTable.put("cp920", "ISO8859_9");
195: aliasTable.put("920", "ISO8859_9");
196: aliasTable.put("csisolatin5", "ISO8859_9");
197:
198: // MIBenum: ???
199: aliasTable.put("8859_13", "ISO8859_13");
200: aliasTable.put("iso_8859-13", "ISO8859_13");
201: aliasTable.put("iso-8859-13", "ISO8859_13");
202: aliasTable.put("iso8859-13", "ISO8859_13");
203:
204: // MIBenum: ????
205: aliasTable.put("8859_15", "ISO8859_15_FDIS");
206: aliasTable.put("iso-8859-15", "ISO8859_15_FDIS");
207: aliasTable.put("iso_8859-15", "ISO8859_15_FDIS");
208: aliasTable.put("iso8859-15", "ISO8859_15_FDIS");
209: aliasTable.put("ibm923", "ISO8859_15_FDIS");
210: aliasTable.put("ibm-923", "ISO8859_15_FDIS");
211: aliasTable.put("cp923", "ISO8859_15_FDIS");
212: aliasTable.put("923", "ISO8859_15_FDIS");
213: aliasTable.put("latin0", "ISO8859_15_FDIS");
214: aliasTable.put("latin9", "ISO8859_15_FDIS");
215: aliasTable.put("csisolatin0", "ISO8859_15_FDIS");
216: aliasTable.put("csisolatin9", "ISO8859_15_FDIS");
217:
218: // MIBenum: 106
219: aliasTable.put("utf-8", "UTF8");
220:
221: // Alias recommended in RFC 1641
222: aliasTable.put("unicode-1-1-utf-8", "UTF8");
223:
224: // MIBenum: 1010
225: aliasTable.put("unicode-1-1", "UnicodeBigUnmarked");
226:
227: // MIBenum: 1000
228: aliasTable.put("iso-10646-ucs-2", "UnicodeBigUnmarked");
229:
230: // Per Unicode standard
231: aliasTable.put("utf-16be", "UnicodeBigUnmarked");
232: aliasTable.put("utf-16le", "UnicodeLittleUnmarked");
233: aliasTable.put("utf-16", "UTF16");
234:
235: // Used by drag-and-drop subsystem
236: aliasTable.put("x-utf-16be", "UnicodeBigUnmarked");
237: aliasTable.put("x-utf-16le", "UnicodeLittleUnmarked");
238:
239: aliasTable.put("unicode", "Unicode");
240:
241: // MIBenum: ????
242: aliasTable.put("ibm037", "Cp037");
243: aliasTable.put("ibm-037", "Cp037");
244: aliasTable.put("cp037", "Cp037");
245: aliasTable.put("037", "Cp037");
246:
247: // MIBenum: ????
248: aliasTable.put("ibm273", "Cp273");
249: aliasTable.put("ibm-273", "Cp273");
250: aliasTable.put("cp273", "Cp273");
251: aliasTable.put("273", "Cp273");
252:
253: // MIBenum: ????
254: aliasTable.put("ibm277", "Cp277");
255: aliasTable.put("ibm-277", "Cp277");
256: aliasTable.put("cp277", "Cp277");
257: aliasTable.put("277", "Cp277");
258:
259: // MIBenum: ????
260: aliasTable.put("ibm278", "Cp278");
261: aliasTable.put("ibm-278", "Cp278");
262: aliasTable.put("cp278", "Cp278");
263: aliasTable.put("278", "Cp278");
264:
265: // MIBenum: ????
266: aliasTable.put("ibm280", "Cp280");
267: aliasTable.put("ibm-280", "Cp280");
268: aliasTable.put("cp280", "Cp280");
269: aliasTable.put("280", "Cp280");
270:
271: // MIBenum: ????
272: aliasTable.put("ibm284", "Cp284");
273: aliasTable.put("ibm-284", "Cp284");
274: aliasTable.put("cp284", "Cp284");
275: aliasTable.put("284", "Cp284");
276:
277: // MIBenum: ????
278: aliasTable.put("ibm285", "Cp285");
279: aliasTable.put("ibm-285", "Cp285");
280: aliasTable.put("cp285", "Cp285");
281: aliasTable.put("285", "Cp285");
282:
283: // MIBenum: ????
284: aliasTable.put("ibm297", "Cp297");
285: aliasTable.put("ibm-297", "Cp297");
286: aliasTable.put("cp297", "Cp297");
287: aliasTable.put("297", "Cp297");
288:
289: // MIBenum: ????
290: aliasTable.put("ibm420", "Cp420");
291: aliasTable.put("ibm-420", "Cp420");
292: aliasTable.put("cp420", "Cp420");
293: aliasTable.put("420", "Cp420");
294:
295: // MIBenum: ????
296: aliasTable.put("ibm424", "Cp424");
297: aliasTable.put("ibm-424", "Cp424");
298: aliasTable.put("cp424", "Cp424");
299: aliasTable.put("424", "Cp424");
300:
301: // MIBenum: 2011
302: aliasTable.put("ibm437", "Cp437");
303: aliasTable.put("ibm-437", "Cp437");
304: aliasTable.put("cp437", "Cp437");
305: aliasTable.put("437", "Cp437");
306: aliasTable.put("cspc8codepage437", "Cp437");
307:
308: // MIBenum: ????
309: aliasTable.put("ibm500", "Cp500");
310: aliasTable.put("ibm-500", "Cp500");
311: aliasTable.put("cp500", "Cp500");
312: aliasTable.put("500", "Cp500");
313:
314: // MIBenum: ????
315: aliasTable.put("ibm737", "Cp737");
316: aliasTable.put("ibm-737", "Cp737");
317: aliasTable.put("cp737", "Cp737");
318: aliasTable.put("737", "Cp737");
319:
320: // MIBenum: ????
321: aliasTable.put("ibm775", "Cp775");
322: aliasTable.put("ibm-775", "Cp775");
323: aliasTable.put("cp775", "Cp775");
324: aliasTable.put("775", "Cp775");
325:
326: // MIBenum: ????
327: aliasTable.put("ibm838", "Cp838"); /* MDA */
328: aliasTable.put("ibm-838", "Cp838"); /* MDA */
329: aliasTable.put("cp838", "Cp838"); /* MDA */
330: aliasTable.put("838", "Cp838"); /* MDA */
331:
332: // "Cp850"
333: // MIBenum: 2009
334: aliasTable.put("ibm850", "Cp850");
335: aliasTable.put("ibm-850", "Cp850");
336: aliasTable.put("cp850", "Cp850");
337: aliasTable.put("850", "Cp850");
338: aliasTable.put("cspc850multilingual", "Cp850");
339:
340: // "Cp852"
341: // MIBenum: 2010
342: aliasTable.put("ibm852", "Cp852");
343: aliasTable.put("ibm-852", "Cp852");
344: aliasTable.put("cp852", "Cp852");
345: aliasTable.put("852", "Cp852");
346: aliasTable.put("cspcp852", "Cp852");
347:
348: // "Cp855"
349: // MIBenum: 2046
350: aliasTable.put("ibm855", "Cp855");
351: aliasTable.put("ibm-855", "Cp855");
352: aliasTable.put("cp855", "Cp855");
353: aliasTable.put("855", "Cp855");
354: aliasTable.put("cspcp855", "Cp855");
355:
356: // "Cp855"
357: // MIBenum: ???
358: aliasTable.put("ibm856", "Cp856");
359: aliasTable.put("ibm-856", "Cp856");
360: aliasTable.put("cp856", "Cp856");
361: aliasTable.put("856", "Cp856");
362:
363: // "Cp857"
364: // MIBenum: 2047
365: aliasTable.put("ibm857", "Cp857");
366: aliasTable.put("ibm-857", "Cp857");
367: aliasTable.put("cp857", "Cp857");
368: aliasTable.put("857", "Cp857");
369: aliasTable.put("csibm857", "Cp857");
370:
371: // "Cp860"
372: // MIBenum: 2048
373: aliasTable.put("ibm860", "Cp860");
374: aliasTable.put("ibm-860", "Cp860");
375: aliasTable.put("cp860", "Cp860");
376: aliasTable.put("860", "Cp860");
377: aliasTable.put("csibm860", "Cp860");
378:
379: // MIBenum: 2049
380: aliasTable.put("ibm861", "Cp861");
381: aliasTable.put("ibm-861", "Cp861");
382: aliasTable.put("cp861", "Cp861");
383: aliasTable.put("cp-is", "Cp861");
384: aliasTable.put("861", "Cp861");
385: aliasTable.put("csibm861", "Cp861");
386:
387: // MIBenum: 2013
388: aliasTable.put("ibm862", "Cp862");
389: aliasTable.put("ibm-862", "Cp862");
390: aliasTable.put("cp862", "Cp862");
391: aliasTable.put("862", "Cp862");
392: aliasTable.put("cspc862latinhebrew", "Cp862");
393:
394: // MIBenum: 2050
395: aliasTable.put("ibm863", "Cp863");
396: aliasTable.put("ibm-863", "Cp863");
397: aliasTable.put("cp863", "Cp863");
398: aliasTable.put("863", "Cp863");
399: aliasTable.put("csibm863", "Cp863");
400:
401: // MIBenum: 2051
402: aliasTable.put("ibm864", "Cp864");
403: aliasTable.put("ibm-864", "Cp864");
404: aliasTable.put("cp864", "Cp864");
405: aliasTable.put("csibm864", "Cp864");
406:
407: // MIBenum: 2052
408: aliasTable.put("ibm865", "Cp865");
409: aliasTable.put("ibm-865", "Cp865");
410: aliasTable.put("cp865", "Cp865");
411: aliasTable.put("865", "Cp865");
412: aliasTable.put("csibm865", "Cp865");
413:
414: // MIBenum: ????
415: aliasTable.put("ibm866", "Cp866");
416: aliasTable.put("ibm-866", "Cp866");
417: aliasTable.put("cp866", "Cp866");
418: aliasTable.put("866", "Cp866");
419: aliasTable.put("csibm866", "Cp866");
420:
421: // MIBenum: ????
422: aliasTable.put("ibm868", "Cp868");
423: aliasTable.put("ibm-868", "Cp868");
424: aliasTable.put("cp868", "Cp868");
425: aliasTable.put("868", "Cp868");
426:
427: // MIBenum: 2054
428: aliasTable.put("ibm869", "Cp869");
429: aliasTable.put("ibm-869", "Cp869");
430: aliasTable.put("cp869", "Cp869");
431: aliasTable.put("869", "Cp869");
432: aliasTable.put("cp-gr", "Cp869");
433: aliasTable.put("csibm869", "Cp869");
434:
435: // MIBenum: ????
436: aliasTable.put("ibm870", "Cp870");
437: aliasTable.put("ibm-870", "Cp870");
438: aliasTable.put("cp870", "Cp870");
439: aliasTable.put("870", "Cp870");
440:
441: // MIBenum: ????
442: aliasTable.put("ibm871", "Cp871");
443: aliasTable.put("ibm-871", "Cp871");
444: aliasTable.put("cp871", "Cp871");
445: aliasTable.put("871", "Cp871");
446:
447: // MIBenum: ????
448: aliasTable.put("ibm874", "Cp874");
449: aliasTable.put("ibm-874", "Cp874");
450: aliasTable.put("cp874", "Cp874");
451: aliasTable.put("874", "Cp874");
452:
453: // MIBenum: ????
454: aliasTable.put("ibm875", "Cp875");
455: aliasTable.put("ibm-875", "Cp875");
456: aliasTable.put("cp875", "Cp875");
457: aliasTable.put("875", "Cp875");
458:
459: // MIBenum: ????
460: aliasTable.put("ibm918", "Cp918");
461: aliasTable.put("ibm-918", "Cp918");
462: aliasTable.put("cp918", "Cp918");
463: aliasTable.put("918", "Cp918");
464:
465: // MIBenum: ????
466: aliasTable.put("ibm921", "Cp921");
467: aliasTable.put("ibm-921", "Cp921");
468: aliasTable.put("cp921", "Cp921");
469: aliasTable.put("921", "Cp921");
470:
471: // MIBenum: ????
472: aliasTable.put("ibm922", "Cp922");
473: aliasTable.put("ibm-922", "Cp922");
474: aliasTable.put("cp922", "Cp922");
475: aliasTable.put("922", "Cp922");
476:
477: // MIBenum: ????
478: aliasTable.put("ibm930", "Cp930"); /* MDA */
479: aliasTable.put("ibm-930", "Cp930"); /* MDA */
480: aliasTable.put("cp930", "Cp930"); /* MDA */
481: aliasTable.put("930", "Cp930"); /* MDA */
482:
483: // MIBenum: ????
484: aliasTable.put("ibm933", "Cp933"); /* MDA */
485: aliasTable.put("ibm-933", "Cp933"); /* MDA */
486: aliasTable.put("cp933", "Cp933"); /* MDA */
487: aliasTable.put("933", "Cp933"); /* MDA */
488:
489: // MIBenum: ????
490: aliasTable.put("ibm935", "Cp935"); /* MDA */
491: aliasTable.put("ibm-935", "Cp935"); /* MDA */
492: aliasTable.put("cp935", "Cp935"); /* MDA */
493: aliasTable.put("935", "Cp935"); /* MDA */
494:
495: // MIBenum: ????
496: aliasTable.put("ibm937", "Cp937"); /* MDA */
497: aliasTable.put("ibm-937", "Cp937"); /* MDA */
498: aliasTable.put("cp937", "Cp937"); /* MDA */
499: aliasTable.put("937", "Cp937"); /* MDA */
500:
501: // MIBenum: ????
502: aliasTable.put("ibm939", "Cp939"); /* MDA */
503: aliasTable.put("ibm-939", "Cp939"); /* MDA */
504: aliasTable.put("cp939", "Cp939"); /* MDA */
505: aliasTable.put("939", "Cp939"); /* MDA */
506:
507: // MIBenum: ????
508: aliasTable.put("ibm942", "Cp942"); /* MDA */
509: aliasTable.put("ibm-942", "Cp942"); /* MDA */
510: aliasTable.put("cp942", "Cp942"); /* MDA */
511: aliasTable.put("942", "Cp942"); /* MDA */
512:
513: // MIBenum: ????
514: aliasTable.put("ibm943", "Cp943"); /* ibm.3158 */
515: aliasTable.put("ibm-943", "Cp943"); /* ibm.3158 */
516: aliasTable.put("cp943", "Cp943"); /* ibm.3158 */
517: aliasTable.put("943", "Cp943"); /* ibm.3158 */
518:
519: // MIBenum: ????
520: aliasTable.put("ibm948", "Cp948"); /* MDA */
521: aliasTable.put("ibm-948", "Cp948"); /* MDA */
522: aliasTable.put("cp948", "Cp948"); /* MDA */
523: aliasTable.put("948", "Cp948"); /* MDA */
524:
525: // MIBenum: ????
526: aliasTable.put("ibm949", "Cp949"); /* MDA */
527: aliasTable.put("ibm-949", "Cp949"); /* MDA */
528: aliasTable.put("cp949", "Cp949"); /* MDA */
529: aliasTable.put("949", "Cp949"); /* MDA */
530:
531: // MIBenum: ????
532: aliasTable.put("ibm950", "Cp950"); /* MDA */
533: aliasTable.put("ibm-950", "Cp950"); /* MDA */
534: aliasTable.put("cp950", "Cp950"); /* MDA */
535: aliasTable.put("950", "Cp950"); /* MDA */
536:
537: // MIBenum: ????
538: aliasTable.put("ibm964", "Cp964"); /* MDA */
539: aliasTable.put("ibm-964", "Cp964"); /* MDA */
540: aliasTable.put("cp964", "Cp964"); /* MDA */
541: aliasTable.put("964", "Cp964"); /* MDA */
542:
543: // MIBenum: ????
544: aliasTable.put("ibm970", "Cp970"); /* MDA */
545: aliasTable.put("ibm-970", "Cp970"); /* MDA */
546: aliasTable.put("cp970", "Cp970"); /* MDA */
547: aliasTable.put("970", "Cp970"); /* MDA */
548:
549: // MIBenum: ????
550: aliasTable.put("ibm1006", "Cp1006");
551: aliasTable.put("ibm-1006", "Cp1006");
552: aliasTable.put("cp1006", "Cp1006");
553: aliasTable.put("1006", "Cp1006");
554:
555: // MIBenum: ????
556: aliasTable.put("ibm1025", "Cp1025");
557: aliasTable.put("ibm-1025", "Cp1025");
558: aliasTable.put("cp1025", "Cp1025");
559: aliasTable.put("1025", "Cp1025");
560:
561: // MIBenum: ????
562: aliasTable.put("ibm1026", "Cp1026");
563: aliasTable.put("ibm-1026", "Cp1026");
564: aliasTable.put("cp1026", "Cp1026");
565: aliasTable.put("1026", "Cp1026");
566:
567: // MIBenum: ????
568: aliasTable.put("ibm1097", "Cp1097");
569: aliasTable.put("ibm-1097", "Cp1097");
570: aliasTable.put("cp1097", "Cp1097");
571: aliasTable.put("1097", "Cp1097");
572:
573: // MIBenum: ????
574: aliasTable.put("ibm1098", "Cp1098");
575: aliasTable.put("ibm-1098", "Cp1098");
576: aliasTable.put("cp1098", "Cp1098");
577: aliasTable.put("1098", "Cp1098");
578:
579: // MIBenum: ????
580: aliasTable.put("ibm1112", "Cp1112");
581: aliasTable.put("ibm-1112", "Cp1112");
582: aliasTable.put("cp1112", "Cp1112");
583: aliasTable.put("1112", "Cp1112");
584:
585: // MIBenum: ????
586: aliasTable.put("ibm1122", "Cp1122");
587: aliasTable.put("ibm-1122", "Cp1122");
588: aliasTable.put("cp1122", "Cp1122");
589: aliasTable.put("1122", "Cp1122");
590:
591: // MIBenum: ????
592: aliasTable.put("ibm1123", "Cp1123");
593: aliasTable.put("ibm-1123", "Cp1123");
594: aliasTable.put("cp1123", "Cp1123");
595: aliasTable.put("1123", "Cp1123");
596:
597: // MIBenum: ????
598: aliasTable.put("ibm1124", "Cp1124");
599: aliasTable.put("ibm-1124", "Cp1124");
600: aliasTable.put("cp1124", "Cp1124");
601: aliasTable.put("1124", "Cp1124");
602:
603: // MIBenum: ????
604: aliasTable.put("ibm1381", "Cp1381"); /* MDA */
605: aliasTable.put("ibm-1381", "Cp1381"); /* MDA */
606: aliasTable.put("cp1381", "Cp1381"); /* MDA */
607: aliasTable.put("1381", "Cp1381"); /* MDA */
608:
609: // MIBenum: ????
610: aliasTable.put("ibm1383", "Cp1383"); /* MDA */
611: aliasTable.put("ibm-1383", "Cp1383"); /* MDA */
612: aliasTable.put("cp1383", "Cp1383"); /* MDA */
613: aliasTable.put("1383", "Cp1383"); /* MDA */
614:
615: // Specialized auto-detection for Japanese charsets
616: aliasTable.put("jis auto detect", "JISAutoDetect");
617:
618: // MIBenum: 16/39
619: aliasTable.put("jis", "ISO2022JP");
620: aliasTable.put("iso-2022-jp", "ISO2022JP");
621: aliasTable.put("csiso2022jp", "ISO2022JP");
622: aliasTable.put("jis_encoding", "ISO2022JP");
623: aliasTable.put("csjisencoding", "ISO2022JP");
624:
625: // MIBenum: 17/2024
626: aliasTable.put("shift_jis", "MS932");
627: aliasTable.put("ms_kanji", "MS932");
628: aliasTable.put("csshiftjis", "MS932");
629: aliasTable.put("windows-31j", "MS932");
630: aliasTable.put("cswindows31j", "MS932");
631: aliasTable.put("x-sjis", "MS932");
632:
633: // JIS-defined Shift JIS
634: aliasTable.put(
635: "\u30b7\u30d5\u30c8\u7b26\u53f7\u5316\u8868\u73fe",
636: "SJIS"); // JIS name
637: aliasTable.put("pck", "SJIS"); // Solaris PCK
638:
639: // MIBenum: 18
640: // Japanese EUC
641: aliasTable.put("eucjis", "EUC_JP");
642: aliasTable.put("euc-jp", "EUC_JP");
643: aliasTable.put("eucjp", "EUC_JP");
644: aliasTable.put("extended_unix_code_packed_format_for_japanese",
645: "EUC_JP");
646: aliasTable.put("cseucpkdfmtjapanese", "EUC_JP");
647: aliasTable.put("x-euc-jp", "EUC_JP");
648: aliasTable.put("x-eucjp", "EUC_JP");
649:
650: // MIBenum: 874
651: aliasTable.put("windows-874", "MS874");
652:
653: // MIBenum: 2250
654: aliasTable.put("windows-1250", "Cp1250");
655:
656: // MIBenum: 2251
657: aliasTable.put("windows-1251", "Cp1251");
658:
659: // MIBenum: 2252
660: aliasTable.put("windows-1252", "Cp1252");
661:
662: // MIBenum: 2253
663: aliasTable.put("windows-1253", "Cp1253");
664:
665: // MIBenum: 2254
666: aliasTable.put("windows-1254", "Cp1254");
667:
668: // MIBenum: 2255
669: aliasTable.put("windows-1255", "Cp1255");
670:
671: // MIBenum: 2256
672: aliasTable.put("windows-1256", "Cp1256");
673:
674: // MIBenum: 2257
675: aliasTable.put("windows-1257", "Cp1257");
676:
677: // MIBenum: 2258
678: aliasTable.put("windows-1258", "Cp1258");
679:
680: // MIBenum: ????
681: aliasTable.put("ibm33722", "Cp33722"); /* MDA */
682: aliasTable.put("ibm-33722", "Cp33722"); /* MDA */
683: aliasTable.put("cp33722", "Cp33722"); /* MDA */
684: aliasTable.put("33722", "Cp33722"); /* MDA */
685:
686: // Russian KOI8-R
687: aliasTable.put("koi8-r", "KOI8_R");
688: aliasTable.put("koi8", "KOI8_R");
689: aliasTable.put("cskoi8r", "KOI8_R");
690:
691: // Simplified Chinese
692: aliasTable.put("gb2312", "EUC_CN");
693: aliasTable.put("gb2312-80", "EUC_CN");
694: aliasTable.put("gb2312-1980", "EUC_CN");
695: aliasTable.put("euc-cn", "EUC_CN");
696: aliasTable.put("euccn", "EUC_CN");
697:
698: aliasTable.put("big5", "Big5");
699: aliasTable.put("big5-hkscs", "Big5_HKSCS");
700: aliasTable.put("big5_hkscs", "Big5_HKSCS");
701: // Added for future compatibility, explicit mapping to Unicode 2.1
702: aliasTable.put("big5-hkscs-unicode21", "Big5_HKSCS");
703:
704: // Traditional Chinese
705: aliasTable.put("cns11643", "EUC_TW");
706: aliasTable.put("euc-tw", "EUC_TW");
707: aliasTable.put("euctw", "EUC_TW");
708:
709: // Korean
710: aliasTable.put("ksc5601", "EUC_KR");
711: aliasTable.put("euc-kr", "EUC_KR");
712: aliasTable.put("euckr", "EUC_KR");
713: aliasTable.put("ks_c_5601-1987", "EUC_KR");
714: aliasTable.put("ksc5601-1987", "EUC_KR");
715: aliasTable.put("ksc5601_1987", "EUC_KR");
716: aliasTable.put("ksc_5601", "EUC_KR");
717: aliasTable.put("5601", "EUC_KR");
718:
719: aliasTable.put("ksc5601-1992", "Johab");
720: aliasTable.put("ksc5601_1992", "Johab");
721: aliasTable.put("ms1361", "Johab");
722:
723: aliasTable.put("windows-949", "MS949");
724:
725: // Thai
726: aliasTable.put("tis620.2533", "TIS620");
727:
728: // Variants
729: aliasTable.put("cp942c", "Cp942C");
730: aliasTable.put("cp943c", "Cp943C");
731: aliasTable.put("cp949c", "Cp949C");
732: }
733:
734: public static String aliasName(String name) {
735: // need to use Locale.US so we can load ISO converters in tr_TR locale
736: return (String) aliasTable.get(name.toLowerCase(Locale.US));
737: }
738:
739: /**
740: * Returns "MS932" if the file.encoding property value is "MS932"
741: * or an alias of "MS932"; otherwise, "SJIS", regardless of its
742: * actual file.encoding value. This method is called from the JIS
743: * Auto Detect converter.
744: */
745: static String getSJISName() {
746: String encodeName = (String) AccessController
747: .doPrivileged(new GetPropertyAction("file.encoding"));
748: String realName;
749: if (encodeName != null) {
750: if (encodeName.equals("MS932"))
751: return encodeName;
752: encodeName = aliasName(encodeName);
753: }
754: return (encodeName != null && encodeName.equals("MS932")) ? encodeName
755: : "SJIS";
756: }
757: }
|