src/com/sun/org/apache/xerces/internal/util/EncodingMap.java

Print this page


   1 /*
   2  * reserved comment block
   3  * DO NOT REMOVE OR ALTER!
   4  */
   5 /*
   6  * Copyright 1999-2002,2004 The Apache Software Foundation.
   7  *
   8  * Licensed under the Apache License, Version 2.0 (the "License");
   9  * you may not use this file except in compliance with the License.
  10  * You may obtain a copy of the License at

  11  *
  12  *      http://www.apache.org/licenses/LICENSE-2.0
  13  *
  14  * Unless required by applicable law or agreed to in writing, software
  15  * distributed under the License is distributed on an "AS IS" BASIS,
  16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17  * See the License for the specific language governing permissions and
  18  * limitations under the License.
  19  */
  20 
  21 package com.sun.org.apache.xerces.internal.util;
  22 
  23 import java.util.Hashtable;
  24 
  25 /**
  26  * EncodingMap is a convenience class which handles conversions between
  27  * IANA encoding names and Java encoding names, and vice versa. The
  28  * encoding names used in XML instance documents <strong>must</strong>
  29  * be the IANA encoding names specified or one of the aliases for those names
  30  * which IANA defines.


 452  *          <P ALIGN="CENTER">iso2022kr
 453  *      </TD>
 454  *  </TR>
 455  *  <TR>
 456  *      <TD WIDTH="33%">Cyrillic</TD>
 457  *      <TD WIDTH="15%">
 458  *          <P ALIGN="CENTER">koi8-r
 459  *      </TD>
 460  *      <TD WIDTH="12%">
 461  *          <P ALIGN="CENTER">MIME
 462  *      </TD>
 463  *      <TD WIDTH="31%">
 464  *          <P ALIGN="CENTER">koi8-r
 465  *      </TD>
 466  *  </TR>
 467  * </TABLE>
 468  *
 469  * @author TAMURA Kent, IBM
 470  * @author Andy Clark, IBM
 471  *

 472  */
 473 public class EncodingMap {
 474 
 475     //
 476     // Data
 477     //
 478 
 479     /** fIANA2JavaMap */
 480     protected final static Hashtable fIANA2JavaMap = new Hashtable();
 481 
 482     /** fJava2IANAMap */
 483     protected final static Hashtable fJava2IANAMap = new Hashtable();
 484 
 485     //
 486     // Static initialization
 487     //
 488 
 489     static {
 490 
 491         // add IANA to Java encoding mappings.


 890         fJava2IANAMap.put("CP775",     "IBM775");
 891         fJava2IANAMap.put("CP850",     "IBM850");
 892         fJava2IANAMap.put("CP852",     "IBM852");
 893         fJava2IANAMap.put("CP855",     "IBM855");
 894         fJava2IANAMap.put("CP857",     "IBM857");
 895         fJava2IANAMap.put("CP858",     "IBM00858");
 896         fJava2IANAMap.put("CP860",     "IBM860");
 897         fJava2IANAMap.put("CP861",     "IBM861");
 898         fJava2IANAMap.put("CP862",     "IBM862");
 899         fJava2IANAMap.put("CP863",     "IBM863");
 900         fJava2IANAMap.put("CP864",     "IBM864");
 901         fJava2IANAMap.put("CP865",     "IBM865");
 902         fJava2IANAMap.put("CP866",     "IBM866");
 903         fJava2IANAMap.put("CP868",     "IBM868");
 904         fJava2IANAMap.put("CP869",     "IBM869");
 905         fJava2IANAMap.put("CP870",     "EBCDIC-CP-ROECE");
 906         fJava2IANAMap.put("CP871",     "EBCDIC-CP-IS");
 907         fJava2IANAMap.put("CP918",     "EBCDIC-CP-AR2");
 908         fJava2IANAMap.put("CP924",     "IBM00924");
 909         fJava2IANAMap.put("CP1026",     "IBM1026");
 910         fJava2IANAMap.put("Cp01140",     "IBM01140");
 911         fJava2IANAMap.put("Cp01141",     "IBM01141");
 912         fJava2IANAMap.put("Cp01142",     "IBM01142");
 913         fJava2IANAMap.put("Cp01143",     "IBM01143");
 914         fJava2IANAMap.put("Cp01144",     "IBM01144");
 915         fJava2IANAMap.put("Cp01145",     "IBM01145");
 916         fJava2IANAMap.put("Cp01146",     "IBM01146");
 917         fJava2IANAMap.put("Cp01147",     "IBM01147");
 918         fJava2IANAMap.put("Cp01148",     "IBM01148");
 919         fJava2IANAMap.put("Cp01149",     "IBM01149");
 920         fJava2IANAMap.put("EUCJIS",    "EUC-JP");
 921         fJava2IANAMap.put("KS_C_5601-1987",          "KS_C_5601-1987");
 922         fJava2IANAMap.put("GB2312",    "GB2312");
 923         fJava2IANAMap.put("ISO2022KR", "ISO-2022-KR");
 924         fJava2IANAMap.put("ISO2022CN", "ISO-2022-CN");
 925         fJava2IANAMap.put("JIS",       "ISO-2022-JP");
 926         fJava2IANAMap.put("KOI8_R",    "KOI8-R");
 927         fJava2IANAMap.put("KSC5601",   "EUC-KR");
 928         fJava2IANAMap.put("GB18030",      "GB18030");
 929         fJava2IANAMap.put("GBK",       "GBK");
 930         fJava2IANAMap.put("SJIS",      "SHIFT_JIS");
 931         fJava2IANAMap.put("MS932",      "WINDOWS-31J");
 932         fJava2IANAMap.put("UTF8",      "UTF-8");
 933         fJava2IANAMap.put("Unicode",   "UTF-16");
 934         fJava2IANAMap.put("UnicodeBig",   "UTF-16BE");
 935         fJava2IANAMap.put("UnicodeLittle",   "UTF-16LE");
 936         fJava2IANAMap.put("JIS0201",  "X0201");
 937         fJava2IANAMap.put("JIS0208",  "X0208");
 938         fJava2IANAMap.put("JIS0212",  "ISO-IR-159");
 939 


   1 /*
   2  * reserved comment block
   3  * DO NOT REMOVE OR ALTER!
   4  */
   5 /*
   6  * Licensed to the Apache Software Foundation (ASF) under one or more
   7  * contributor license agreements.  See the NOTICE file distributed with
   8  * this work for additional information regarding copyright ownership.
   9  * The ASF licenses this file to You under the Apache License, Version 2.0
  10  * (the "License"); you may not use this file except in compliance with
  11  * the License.  You may obtain a copy of the License at
  12  * 
  13  *      http://www.apache.org/licenses/LICENSE-2.0
  14  * 
  15  * Unless required by applicable law or agreed to in writing, software
  16  * distributed under the License is distributed on an "AS IS" BASIS,
  17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  18  * See the License for the specific language governing permissions and
  19  * limitations under the License.
  20  */
  21 
  22 package com.sun.org.apache.xerces.internal.util;
  23 
  24 import java.util.Hashtable;
  25 
  26 /**
  27  * EncodingMap is a convenience class which handles conversions between 
  28  * IANA encoding names and Java encoding names, and vice versa. The
  29  * encoding names used in XML instance documents <strong>must</strong>
  30  * be the IANA encoding names specified or one of the aliases for those names
  31  * which IANA defines.


 453  *          <P ALIGN="CENTER">iso2022kr
 454  *      </TD>
 455  *  </TR>
 456  *  <TR>
 457  *      <TD WIDTH="33%">Cyrillic</TD>
 458  *      <TD WIDTH="15%">
 459  *          <P ALIGN="CENTER">koi8-r
 460  *      </TD>
 461  *      <TD WIDTH="12%">
 462  *          <P ALIGN="CENTER">MIME
 463  *      </TD>
 464  *      <TD WIDTH="31%">
 465  *          <P ALIGN="CENTER">koi8-r
 466  *      </TD>
 467  *  </TR>
 468  * </TABLE>
 469  * 
 470  * @author TAMURA Kent, IBM
 471  * @author Andy Clark, IBM
 472  *
 473  * @version $Id$
 474  */
 475 public class EncodingMap {
 476 
 477     //
 478     // Data
 479     //
 480 
 481     /** fIANA2JavaMap */
 482     protected final static Hashtable fIANA2JavaMap = new Hashtable();
 483 
 484     /** fJava2IANAMap */
 485     protected final static Hashtable fJava2IANAMap = new Hashtable();
 486 
 487     //
 488     // Static initialization
 489     //
 490 
 491     static {
 492 
 493         // add IANA to Java encoding mappings.


 892         fJava2IANAMap.put("CP775",     "IBM775");
 893         fJava2IANAMap.put("CP850",     "IBM850");
 894         fJava2IANAMap.put("CP852",     "IBM852");
 895         fJava2IANAMap.put("CP855",     "IBM855");
 896         fJava2IANAMap.put("CP857",     "IBM857");
 897         fJava2IANAMap.put("CP858",     "IBM00858");
 898         fJava2IANAMap.put("CP860",     "IBM860");
 899         fJava2IANAMap.put("CP861",     "IBM861");
 900         fJava2IANAMap.put("CP862",     "IBM862");
 901         fJava2IANAMap.put("CP863",     "IBM863");
 902         fJava2IANAMap.put("CP864",     "IBM864");
 903         fJava2IANAMap.put("CP865",     "IBM865");
 904         fJava2IANAMap.put("CP866",     "IBM866");
 905         fJava2IANAMap.put("CP868",     "IBM868");
 906         fJava2IANAMap.put("CP869",     "IBM869");
 907         fJava2IANAMap.put("CP870",     "EBCDIC-CP-ROECE");
 908         fJava2IANAMap.put("CP871",     "EBCDIC-CP-IS");
 909         fJava2IANAMap.put("CP918",     "EBCDIC-CP-AR2");
 910         fJava2IANAMap.put("CP924",     "IBM00924");
 911         fJava2IANAMap.put("CP1026",     "IBM1026");
 912         fJava2IANAMap.put("CP1140",     "IBM01140");
 913         fJava2IANAMap.put("CP1141",     "IBM01141");
 914         fJava2IANAMap.put("CP1142",     "IBM01142");
 915         fJava2IANAMap.put("CP1143",     "IBM01143");
 916         fJava2IANAMap.put("CP1144",     "IBM01144");
 917         fJava2IANAMap.put("CP1145",     "IBM01145");
 918         fJava2IANAMap.put("CP1146",     "IBM01146");
 919         fJava2IANAMap.put("CP1147",     "IBM01147");
 920         fJava2IANAMap.put("CP1148",     "IBM01148");
 921         fJava2IANAMap.put("CP1149",     "IBM01149");
 922         fJava2IANAMap.put("EUCJIS",    "EUC-JP");
 923         fJava2IANAMap.put("KS_C_5601-1987",          "KS_C_5601-1987");
 924         fJava2IANAMap.put("GB2312",    "GB2312");
 925         fJava2IANAMap.put("ISO2022KR", "ISO-2022-KR");
 926         fJava2IANAMap.put("ISO2022CN", "ISO-2022-CN");
 927         fJava2IANAMap.put("JIS",       "ISO-2022-JP");
 928         fJava2IANAMap.put("KOI8_R",    "KOI8-R");
 929         fJava2IANAMap.put("KSC5601",   "EUC-KR");
 930         fJava2IANAMap.put("GB18030",      "GB18030");
 931         fJava2IANAMap.put("GBK",       "GBK");
 932         fJava2IANAMap.put("SJIS",      "SHIFT_JIS");
 933         fJava2IANAMap.put("MS932",      "WINDOWS-31J");
 934         fJava2IANAMap.put("UTF8",      "UTF-8");
 935         fJava2IANAMap.put("Unicode",   "UTF-16");
 936         fJava2IANAMap.put("UnicodeBig",   "UTF-16BE");
 937         fJava2IANAMap.put("UnicodeLittle",   "UTF-16LE");
 938         fJava2IANAMap.put("JIS0201",  "X0201");
 939         fJava2IANAMap.put("JIS0208",  "X0208");
 940         fJava2IANAMap.put("JIS0212",  "ISO-IR-159");
 941