001: package com.flexive.war.webdav.catalina;
002:
003: import java.util.Hashtable;
004:
005: /**
006: * Catalina sources cloned for packaging issues to the flexive source tree.
007: * Refactored to JDK 1.5 compatibility.
008: * Licensed under the Apache License, Version 2.0
009: * <p/>
010: * MIME2Java is a convenience class which handles conversions between MIME charset names
011: * and Java encoding names.
012: * <p>The supported XML encodings are the intersection of XML-supported code sets and those
013: * supported in JDK 1.1.
014: * <p>MIME charset names are used on <var>xmlEncoding</var> parameters to methods such
015: * as <code>TXDocument#setEncoding</code> and <code>DTD#setEncoding</code>.
016: * <p>Java encoding names are used on <var>encoding</var> parameters to
017: * methods such as <code>TXDocument#printWithFormat</code> and <code>DTD#printExternal</code>.
018: * <p/>
019: * <Table BORDER="0" WIDTH="100%">
020: * <TR>
021: * <TD WIDTH="33%">
022: * <P ALIGN="CENTER"><B>Common Name</B>
023: * </TD>
024: * <TD WIDTH="15%">
025: * <P ALIGN="CENTER"><B>Use this name in XML files</B>
026: * </TD>
027: * <TD WIDTH="12%">
028: * <P ALIGN="CENTER"><B>Name Type</B>
029: * </TD>
030: * <TD WIDTH="31%">
031: * <P ALIGN="CENTER"><B>Xerces converts to this Java Encoder Name</B>
032: * </TD>
033: * </TR>
034: * <TR>
035: * <TD WIDTH="33%">8 bit Unicode</TD>
036: * <TD WIDTH="15%">
037: * <P ALIGN="CENTER">UTF-8
038: * </TD>
039: * <TD WIDTH="12%">
040: * <P ALIGN="CENTER">IANA
041: * </TD>
042: * <TD WIDTH="31%">
043: * <P ALIGN="CENTER">UTF8
044: * </TD>
045: * </TR>
046: * <TR>
047: * <TD WIDTH="33%">ISO Latin 1</TD>
048: * <TD WIDTH="15%">
049: * <P ALIGN="CENTER">ISO-8859-1
050: * </TD>
051: * <TD WIDTH="12%">
052: * <P ALIGN="CENTER">MIME
053: * </TD>
054: * <TD WIDTH="31%">
055: * <P ALIGN="CENTER">ISO-8859-1
056: * </TD>
057: * </TR>
058: * <TR>
059: * <TD WIDTH="33%">ISO Latin 2</TD>
060: * <TD WIDTH="15%">
061: * <P ALIGN="CENTER">ISO-8859-2
062: * </TD>
063: * <TD WIDTH="12%">
064: * <P ALIGN="CENTER">MIME
065: * </TD>
066: * <TD WIDTH="31%">
067: * <P ALIGN="CENTER">ISO-8859-2
068: * </TD>
069: * </TR>
070: * <TR>
071: * <TD WIDTH="33%">ISO Latin 3</TD>
072: * <TD WIDTH="15%">
073: * <P ALIGN="CENTER">ISO-8859-3
074: * </TD>
075: * <TD WIDTH="12%">
076: * <P ALIGN="CENTER">MIME
077: * </TD>
078: * <TD WIDTH="31%">
079: * <P ALIGN="CENTER">ISO-8859-3
080: * </TD>
081: * </TR>
082: * <TR>
083: * <TD WIDTH="33%">ISO Latin 4</TD>
084: * <TD WIDTH="15%">
085: * <P ALIGN="CENTER">ISO-8859-4
086: * </TD>
087: * <TD WIDTH="12%">
088: * <P ALIGN="CENTER">MIME
089: * </TD>
090: * <TD WIDTH="31%">
091: * <P ALIGN="CENTER">ISO-8859-4
092: * </TD>
093: * </TR>
094: * <TR>
095: * <TD WIDTH="33%">ISO Latin Cyrillic</TD>
096: * <TD WIDTH="15%">
097: * <P ALIGN="CENTER">ISO-8859-5
098: * </TD>
099: * <TD WIDTH="12%">
100: * <P ALIGN="CENTER">MIME
101: * </TD>
102: * <TD WIDTH="31%">
103: * <P ALIGN="CENTER">ISO-8859-5
104: * </TD>
105: * </TR>
106: * <TR>
107: * <TD WIDTH="33%">ISO Latin Arabic</TD>
108: * <TD WIDTH="15%">
109: * <P ALIGN="CENTER">ISO-8859-6
110: * </TD>
111: * <TD WIDTH="12%">
112: * <P ALIGN="CENTER">MIME
113: * </TD>
114: * <TD WIDTH="31%">
115: * <P ALIGN="CENTER">ISO-8859-6
116: * </TD>
117: * </TR>
118: * <TR>
119: * <TD WIDTH="33%">ISO Latin Greek</TD>
120: * <TD WIDTH="15%">
121: * <P ALIGN="CENTER">ISO-8859-7
122: * </TD>
123: * <TD WIDTH="12%">
124: * <P ALIGN="CENTER">MIME
125: * </TD>
126: * <TD WIDTH="31%">
127: * <P ALIGN="CENTER">ISO-8859-7
128: * </TD>
129: * </TR>
130: * <TR>
131: * <TD WIDTH="33%">ISO Latin Hebrew</TD>
132: * <TD WIDTH="15%">
133: * <P ALIGN="CENTER">ISO-8859-8
134: * </TD>
135: * <TD WIDTH="12%">
136: * <P ALIGN="CENTER">MIME
137: * </TD>
138: * <TD WIDTH="31%">
139: * <P ALIGN="CENTER">ISO-8859-8
140: * </TD>
141: * </TR>
142: * <TR>
143: * <TD WIDTH="33%">ISO Latin 5</TD>
144: * <TD WIDTH="15%">
145: * <P ALIGN="CENTER">ISO-8859-9
146: * </TD>
147: * <TD WIDTH="12%">
148: * <P ALIGN="CENTER">MIME
149: * </TD>
150: * <TD WIDTH="31%">
151: * <P ALIGN="CENTER">ISO-8859-9
152: * </TD>
153: * </TR>
154: * <TR>
155: * <TD WIDTH="33%">EBCDIC: US</TD>
156: * <TD WIDTH="15%">
157: * <P ALIGN="CENTER">ebcdic-cp-us
158: * </TD>
159: * <TD WIDTH="12%">
160: * <P ALIGN="CENTER">IANA
161: * </TD>
162: * <TD WIDTH="31%">
163: * <P ALIGN="CENTER">cp037
164: * </TD>
165: * </TR>
166: * <TR>
167: * <TD WIDTH="33%">EBCDIC: Canada</TD>
168: * <TD WIDTH="15%">
169: * <P ALIGN="CENTER">ebcdic-cp-ca
170: * </TD>
171: * <TD WIDTH="12%">
172: * <P ALIGN="CENTER">IANA
173: * </TD>
174: * <TD WIDTH="31%">
175: * <P ALIGN="CENTER">cp037
176: * </TD>
177: * </TR>
178: * <TR>
179: * <TD WIDTH="33%">EBCDIC: Netherlands</TD>
180: * <TD WIDTH="15%">
181: * <P ALIGN="CENTER">ebcdic-cp-nl
182: * </TD>
183: * <TD WIDTH="12%">
184: * <P ALIGN="CENTER">IANA
185: * </TD>
186: * <TD WIDTH="31%">
187: * <P ALIGN="CENTER">cp037
188: * </TD>
189: * </TR>
190: * <TR>
191: * <TD WIDTH="33%">EBCDIC: Denmark</TD>
192: * <TD WIDTH="15%">
193: * <P ALIGN="CENTER">ebcdic-cp-dk
194: * </TD>
195: * <TD WIDTH="12%">
196: * <P ALIGN="CENTER">IANA
197: * </TD>
198: * <TD WIDTH="31%">
199: * <P ALIGN="CENTER">cp277
200: * </TD>
201: * </TR>
202: * <TR>
203: * <TD WIDTH="33%">EBCDIC: Norway</TD>
204: * <TD WIDTH="15%">
205: * <P ALIGN="CENTER">ebcdic-cp-no
206: * </TD>
207: * <TD WIDTH="12%">
208: * <P ALIGN="CENTER">IANA
209: * </TD>
210: * <TD WIDTH="31%">
211: * <P ALIGN="CENTER">cp277
212: * </TD>
213: * </TR>
214: * <TR>
215: * <TD WIDTH="33%">EBCDIC: Finland</TD>
216: * <TD WIDTH="15%">
217: * <P ALIGN="CENTER">ebcdic-cp-fi
218: * </TD>
219: * <TD WIDTH="12%">
220: * <P ALIGN="CENTER">IANA
221: * </TD>
222: * <TD WIDTH="31%">
223: * <P ALIGN="CENTER">cp278
224: * </TD>
225: * </TR>
226: * <TR>
227: * <TD WIDTH="33%">EBCDIC: Sweden</TD>
228: * <TD WIDTH="15%">
229: * <P ALIGN="CENTER">ebcdic-cp-se
230: * </TD>
231: * <TD WIDTH="12%">
232: * <P ALIGN="CENTER">IANA
233: * </TD>
234: * <TD WIDTH="31%">
235: * <P ALIGN="CENTER">cp278
236: * </TD>
237: * </TR>
238: * <TR>
239: * <TD WIDTH="33%">EBCDIC: Italy</TD>
240: * <TD WIDTH="15%">
241: * <P ALIGN="CENTER">ebcdic-cp-it
242: * </TD>
243: * <TD WIDTH="12%">
244: * <P ALIGN="CENTER">IANA
245: * </TD>
246: * <TD WIDTH="31%">
247: * <P ALIGN="CENTER">cp280
248: * </TD>
249: * </TR>
250: * <TR>
251: * <TD WIDTH="33%">EBCDIC: Spain, Latin America</TD>
252: * <TD WIDTH="15%">
253: * <P ALIGN="CENTER">ebcdic-cp-es
254: * </TD>
255: * <TD WIDTH="12%">
256: * <P ALIGN="CENTER">IANA
257: * </TD>
258: * <TD WIDTH="31%">
259: * <P ALIGN="CENTER">cp284
260: * </TD>
261: * </TR>
262: * <TR>
263: * <TD WIDTH="33%">EBCDIC: Great Britain</TD>
264: * <TD WIDTH="15%">
265: * <P ALIGN="CENTER">ebcdic-cp-gb
266: * </TD>
267: * <TD WIDTH="12%">
268: * <P ALIGN="CENTER">IANA
269: * </TD>
270: * <TD WIDTH="31%">
271: * <P ALIGN="CENTER">cp285
272: * </TD>
273: * </TR>
274: * <TR>
275: * <TD WIDTH="33%">EBCDIC: France</TD>
276: * <TD WIDTH="15%">
277: * <P ALIGN="CENTER">ebcdic-cp-fr
278: * </TD>
279: * <TD WIDTH="12%">
280: * <P ALIGN="CENTER">IANA
281: * </TD>
282: * <TD WIDTH="31%">
283: * <P ALIGN="CENTER">cp297
284: * </TD>
285: * </TR>
286: * <TR>
287: * <TD WIDTH="33%">EBCDIC: Arabic</TD>
288: * <TD WIDTH="15%">
289: * <P ALIGN="CENTER">ebcdic-cp-ar1
290: * </TD>
291: * <TD WIDTH="12%">
292: * <P ALIGN="CENTER">IANA
293: * </TD>
294: * <TD WIDTH="31%">
295: * <P ALIGN="CENTER">cp420
296: * </TD>
297: * </TR>
298: * <TR>
299: * <TD WIDTH="33%">EBCDIC: Hebrew</TD>
300: * <TD WIDTH="15%">
301: * <P ALIGN="CENTER">ebcdic-cp-he
302: * </TD>
303: * <TD WIDTH="12%">
304: * <P ALIGN="CENTER">IANA
305: * </TD>
306: * <TD WIDTH="31%">
307: * <P ALIGN="CENTER">cp424
308: * </TD>
309: * </TR>
310: * <TR>
311: * <TD WIDTH="33%">EBCDIC: Switzerland</TD>
312: * <TD WIDTH="15%">
313: * <P ALIGN="CENTER">ebcdic-cp-ch
314: * </TD>
315: * <TD WIDTH="12%">
316: * <P ALIGN="CENTER">IANA
317: * </TD>
318: * <TD WIDTH="31%">
319: * <P ALIGN="CENTER">cp500
320: * </TD>
321: * </TR>
322: * <TR>
323: * <TD WIDTH="33%">EBCDIC: Roece</TD>
324: * <TD WIDTH="15%">
325: * <P ALIGN="CENTER">ebcdic-cp-roece
326: * </TD>
327: * <TD WIDTH="12%">
328: * <P ALIGN="CENTER">IANA
329: * </TD>
330: * <TD WIDTH="31%">
331: * <P ALIGN="CENTER">cp870
332: * </TD>
333: * </TR>
334: * <TR>
335: * <TD WIDTH="33%">EBCDIC: Yogoslavia</TD>
336: * <TD WIDTH="15%">
337: * <P ALIGN="CENTER">ebcdic-cp-yu
338: * </TD>
339: * <TD WIDTH="12%">
340: * <P ALIGN="CENTER">IANA
341: * </TD>
342: * <TD WIDTH="31%">
343: * <P ALIGN="CENTER">cp870
344: * </TD>
345: * </TR>
346: * <TR>
347: * <TD WIDTH="33%">EBCDIC: Iceland</TD>
348: * <TD WIDTH="15%">
349: * <P ALIGN="CENTER">ebcdic-cp-is
350: * </TD>
351: * <TD WIDTH="12%">
352: * <P ALIGN="CENTER">IANA
353: * </TD>
354: * <TD WIDTH="31%">
355: * <P ALIGN="CENTER">cp871
356: * </TD>
357: * </TR>
358: * <TR>
359: * <TD WIDTH="33%">EBCDIC: Urdu</TD>
360: * <TD WIDTH="15%">
361: * <P ALIGN="CENTER">ebcdic-cp-ar2
362: * </TD>
363: * <TD WIDTH="12%">
364: * <P ALIGN="CENTER">IANA
365: * </TD>
366: * <TD WIDTH="31%">
367: * <P ALIGN="CENTER">cp918
368: * </TD>
369: * </TR>
370: * <TR>
371: * <TD WIDTH="33%">Chinese for PRC, mixed 1/2 byte</TD>
372: * <TD WIDTH="15%">
373: * <P ALIGN="CENTER">gb2312
374: * </TD>
375: * <TD WIDTH="12%">
376: * <P ALIGN="CENTER">MIME
377: * </TD>
378: * <TD WIDTH="31%">
379: * <P ALIGN="CENTER">GB2312
380: * </TD>
381: * </TR>
382: * <TR>
383: * <TD WIDTH="33%">Extended Unix Code, packed for Japanese</TD>
384: * <TD WIDTH="15%">
385: * <P ALIGN="CENTER">euc-jp
386: * </TD>
387: * <TD WIDTH="12%">
388: * <P ALIGN="CENTER">MIME
389: * </TD>
390: * <TD WIDTH="31%">
391: * <P ALIGN="CENTER">eucjis
392: * </TD>
393: * </TR>
394: * <TR>
395: * <TD WIDTH="33%">Japanese: iso-2022-jp</TD>
396: * <TD WIDTH="15%">
397: * <P ALIGN="CENTER">iso-2020-jp
398: * </TD>
399: * <TD WIDTH="12%">
400: * <P ALIGN="CENTER">MIME
401: * </TD>
402: * <TD WIDTH="31%">
403: * <P ALIGN="CENTER">JIS
404: * </TD>
405: * </TR>
406: * <TR>
407: * <TD WIDTH="33%">Japanese: Shift JIS</TD>
408: * <TD WIDTH="15%">
409: * <P ALIGN="CENTER">Shift_JIS
410: * </TD>
411: * <TD WIDTH="12%">
412: * <P ALIGN="CENTER">MIME
413: * </TD>
414: * <TD WIDTH="31%">
415: * <P ALIGN="CENTER">SJIS
416: * </TD>
417: * </TR>
418: * <TR>
419: * <TD WIDTH="33%">Chinese: Big5</TD>
420: * <TD WIDTH="15%">
421: * <P ALIGN="CENTER">Big5
422: * </TD>
423: * <TD WIDTH="12%">
424: * <P ALIGN="CENTER">MIME
425: * </TD>
426: * <TD WIDTH="31%">
427: * <P ALIGN="CENTER">Big5
428: * </TD>
429: * </TR>
430: * <TR>
431: * <TD WIDTH="33%">Extended Unix Code, packed for Korean</TD>
432: * <TD WIDTH="15%">
433: * <P ALIGN="CENTER">euc-kr
434: * </TD>
435: * <TD WIDTH="12%">
436: * <P ALIGN="CENTER">MIME
437: * </TD>
438: * <TD WIDTH="31%">
439: * <P ALIGN="CENTER">iso2022kr
440: * </TD>
441: * </TR>
442: * <TR>
443: * <TD WIDTH="33%">Cyrillic</TD>
444: * <TD WIDTH="15%">
445: * <P ALIGN="CENTER">koi8-r
446: * </TD>
447: * <TD WIDTH="12%">
448: * <P ALIGN="CENTER">MIME
449: * </TD>
450: * <TD WIDTH="31%">
451: * <P ALIGN="CENTER">koi8-r
452: * </TD>
453: * </TR>
454: * </Table>
455: *
456: * @author TAMURA Kent <kent@trl.ibm.co.jp>
457: * @author Markus Plesser (markus.plesser@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)
458: */
459: public class MIME2Java {
460:
461: static private Hashtable<String, String> s_enchash;
462: static private Hashtable<String, String> s_revhash;
463:
464: static {
465: s_enchash = new Hashtable<String, String>();
466: // <preferred MIME name>, <Java encoding name>
467: s_enchash.put("UTF-8", "UTF8");
468: s_enchash.put("US-ASCII", "8859_1"); // ?
469: s_enchash.put("ISO-8859-1", "8859_1");
470: s_enchash.put("ISO-8859-2", "8859_2");
471: s_enchash.put("ISO-8859-3", "8859_3");
472: s_enchash.put("ISO-8859-4", "8859_4");
473: s_enchash.put("ISO-8859-5", "8859_5");
474: s_enchash.put("ISO-8859-6", "8859_6");
475: s_enchash.put("ISO-8859-7", "8859_7");
476: s_enchash.put("ISO-8859-8", "8859_8");
477: s_enchash.put("ISO-8859-9", "8859_9");
478: s_enchash.put("ISO-2022-JP", "JIS");
479: s_enchash.put("SHIFT_JIS", "SJIS");
480: s_enchash.put("EUC-JP", "EUCJIS");
481: s_enchash.put("GB2312", "GB2312");
482: s_enchash.put("BIG5", "Big5");
483: s_enchash.put("EUC-KR", "KSC5601");
484: s_enchash.put("ISO-2022-KR", "ISO2022KR");
485: s_enchash.put("KOI8-R", "KOI8_R");
486:
487: s_enchash.put("EBCDIC-CP-US", "CP037");
488: s_enchash.put("EBCDIC-CP-CA", "CP037");
489: s_enchash.put("EBCDIC-CP-NL", "CP037");
490: s_enchash.put("EBCDIC-CP-DK", "CP277");
491: s_enchash.put("EBCDIC-CP-NO", "CP277");
492: s_enchash.put("EBCDIC-CP-FI", "CP278");
493: s_enchash.put("EBCDIC-CP-SE", "CP278");
494: s_enchash.put("EBCDIC-CP-IT", "CP280");
495: s_enchash.put("EBCDIC-CP-ES", "CP284");
496: s_enchash.put("EBCDIC-CP-GB", "CP285");
497: s_enchash.put("EBCDIC-CP-FR", "CP297");
498: s_enchash.put("EBCDIC-CP-AR1", "CP420");
499: s_enchash.put("EBCDIC-CP-HE", "CP424");
500: s_enchash.put("EBCDIC-CP-CH", "CP500");
501: s_enchash.put("EBCDIC-CP-ROECE", "CP870");
502: s_enchash.put("EBCDIC-CP-YU", "CP870");
503: s_enchash.put("EBCDIC-CP-IS", "CP871");
504: s_enchash.put("EBCDIC-CP-AR2", "CP918");
505:
506: // j:CNS11643 -> EUC-TW?
507: // ISO-2022-CN? ISO-2022-CN-EXT?
508:
509: s_revhash = new Hashtable<String, String>();
510: // <Java encoding name>, <preferred MIME name>
511: s_revhash.put("UTF8", "UTF-8");
512: //s_revhash.put("8859_1", "US-ASCII"); // ?
513: s_revhash.put("8859_1", "ISO-8859-1");
514: s_revhash.put("8859_2", "ISO-8859-2");
515: s_revhash.put("8859_3", "ISO-8859-3");
516: s_revhash.put("8859_4", "ISO-8859-4");
517: s_revhash.put("8859_5", "ISO-8859-5");
518: s_revhash.put("8859_6", "ISO-8859-6");
519: s_revhash.put("8859_7", "ISO-8859-7");
520: s_revhash.put("8859_8", "ISO-8859-8");
521: s_revhash.put("8859_9", "ISO-8859-9");
522: s_revhash.put("JIS", "ISO-2022-JP");
523: s_revhash.put("SJIS", "Shift_JIS");
524: s_revhash.put("EUCJIS", "EUC-JP");
525: s_revhash.put("GB2312", "GB2312");
526: s_revhash.put("BIG5", "Big5");
527: s_revhash.put("KSC5601", "EUC-KR");
528: s_revhash.put("ISO2022KR", "ISO-2022-KR");
529: s_revhash.put("KOI8_R", "KOI8-R");
530:
531: s_revhash.put("CP037", "EBCDIC-CP-US");
532: s_revhash.put("CP037", "EBCDIC-CP-CA");
533: s_revhash.put("CP037", "EBCDIC-CP-NL");
534: s_revhash.put("CP277", "EBCDIC-CP-DK");
535: s_revhash.put("CP277", "EBCDIC-CP-NO");
536: s_revhash.put("CP278", "EBCDIC-CP-FI");
537: s_revhash.put("CP278", "EBCDIC-CP-SE");
538: s_revhash.put("CP280", "EBCDIC-CP-IT");
539: s_revhash.put("CP284", "EBCDIC-CP-ES");
540: s_revhash.put("CP285", "EBCDIC-CP-GB");
541: s_revhash.put("CP297", "EBCDIC-CP-FR");
542: s_revhash.put("CP420", "EBCDIC-CP-AR1");
543: s_revhash.put("CP424", "EBCDIC-CP-HE");
544: s_revhash.put("CP500", "EBCDIC-CP-CH");
545: s_revhash.put("CP870", "EBCDIC-CP-ROECE");
546: s_revhash.put("CP870", "EBCDIC-CP-YU");
547: s_revhash.put("CP871", "EBCDIC-CP-IS");
548: s_revhash.put("CP918", "EBCDIC-CP-AR2");
549: }
550:
551: private MIME2Java() {
552: }
553:
554: /**
555: * Convert a MIME charset name, also known as an XML encoding name, to a Java encoding name.
556: *
557: * @param mimeCharsetName Case insensitive MIME charset name: <code>UTF-8, US-ASCII, ISO-8859-1,
558: * ISO-8859-2, ISO-8859-3, ISO-8859-4, ISO-8859-5, ISO-8859-6,
559: * ISO-8859-7, ISO-8859-8, ISO-8859-9, ISO-2022-JP, Shift_JIS,
560: * EUC-JP, GB2312, Big5, EUC-KR, ISO-2022-KR, KOI8-R,
561: * EBCDIC-CP-US, EBCDIC-CP-CA, EBCDIC-CP-NL, EBCDIC-CP-DK,
562: * EBCDIC-CP-NO, EBCDIC-CP-FI, EBCDIC-CP-SE, EBCDIC-CP-IT,
563: * EBCDIC-CP-ES, EBCDIC-CP-GB, EBCDIC-CP-FR, EBCDIC-CP-AR1,
564: * EBCDIC-CP-HE, EBCDIC-CP-CH, EBCDIC-CP-ROECE, EBCDIC-CP-YU,
565: * EBCDIC-CP-IS and EBCDIC-CP-AR2</code>.
566: * @return Java encoding name, or <var>null</var> if <var>mimeCharsetName</var>
567: * is unknown.
568: * @see #reverse
569: */
570: public static String convert(String mimeCharsetName) {
571: return s_enchash.get(mimeCharsetName.toUpperCase());
572: }
573:
574: /**
575: * Convert a Java encoding name to MIME charset name.
576: * Available values of <i>encoding</i> are "UTF8", "8859_1", "8859_2", "8859_3", "8859_4",
577: * "8859_5", "8859_6", "8859_7", "8859_8", "8859_9", "JIS", "SJIS", "EUCJIS",
578: * "GB2312", "BIG5", "KSC5601", "ISO2022KR", "KOI8_R", "CP037", "CP277", "CP278",
579: * "CP280", "CP284", "CP285", "CP297", "CP420", "CP424", "CP500", "CP870", "CP871" and "CP918".
580: *
581: * @param encoding Case insensitive Java encoding name: <code>UTF8, 8859_1, 8859_2, 8859_3,
582: * 8859_4, 8859_5, 8859_6, 8859_7, 8859_8, 8859_9, JIS, SJIS, EUCJIS,
583: * GB2312, BIG5, KSC5601, ISO2022KR, KOI8_R, CP037, CP277, CP278,
584: * CP280, CP284, CP285, CP297, CP420, CP424, CP500, CP870, CP871
585: * and CP918</code>.
586: * @return MIME charset name, or <var>null</var> if <var>encoding</var> is unknown.
587: * @see #convert
588: */
589: public static String reverse(String encoding) {
590: return s_revhash.get(encoding.toUpperCase());
591: }
592: }
|