88/**
99 * Converts to and from the character encoding used by the backend.
1010 *
11- * $Id: Encoding.java,v 1.1 2001/07/21 18:52:11 momjian Exp $
11+ * $Id: Encoding.java,v 1.2 2001/10/16 20:07:17 barry Exp $
1212 */
1313
1414public class Encoding {
@@ -21,27 +21,40 @@ public class Encoding {
2121private static final Hashtable encodings =new Hashtable ();
2222
2323static {
24+ //Note: this list should match the set of supported server
25+ // encodings found in backend/util/mb/encnames.c
2426encodings .put ("SQL_ASCII" ,new String [] {"ASCII" ,"us-ascii" });
2527encodings .put ("UNICODE" ,new String [] {"UTF-8" ,"UTF8" });
2628encodings .put ("LATIN1" ,new String [] {"ISO8859_1" });
2729encodings .put ("LATIN2" ,new String [] {"ISO8859_2" });
2830encodings .put ("LATIN3" ,new String [] {"ISO8859_3" });
2931encodings .put ("LATIN4" ,new String [] {"ISO8859_4" });
30- encodings .put ("LATIN5" ,new String [] {"ISO8859_5" });
31- encodings .put ("LATIN6" ,new String [] {"ISO8859_6" });
32- encodings .put ("LATIN7" ,new String [] {"ISO8859_7" });
33- encodings .put ("LATIN8" ,new String [] {"ISO8859_8" });
34- encodings .put ("LATIN9" ,new String [] {"ISO8859_9" });
32+ encodings .put ("ISO_8859_5" ,new String [] {"ISO8859_5" });
33+ encodings .put ("ISO_8859_6" ,new String [] {"ISO8859_6" });
34+ encodings .put ("ISO_8859_7" ,new String [] {"ISO8859_7" });
35+ encodings .put ("ISO_8859_8" ,new String [] {"ISO8859_8" });
36+ encodings .put ("LATIN5" ,new String [] {"ISO8859_9" });
37+ encodings .put ("LATIN7" ,new String [] {"ISO8859_13" });
38+ encodings .put ("LATIN9" ,new String [] {"ISO8859_15_FDIS" });
3539encodings .put ("EUC_JP" ,new String [] {"EUC_JP" });
3640encodings .put ("EUC_CN" ,new String [] {"EUC_CN" });
3741encodings .put ("EUC_KR" ,new String [] {"EUC_KR" });
3842encodings .put ("EUC_TW" ,new String [] {"EUC_TW" });
39- encodings .put ("WIN" ,new String [] {"Cp1252" });
43+ encodings .put ("SJIS" ,new String [] {"SJIS" });
44+ encodings .put ("BIG5" ,new String [] {"Big5" });
45+ encodings .put ("WIN1250" ,new String [] {"Cp1250" });
46+ encodings .put ("WIN" ,new String [] {"Cp1251" });
47+ encodings .put ("ALT" ,new String [] {"Cp866" });
4048// We prefer KOI8-U, since it is a superset of KOI8-R.
4149encodings .put ("KOI8" ,new String [] {"KOI8_U" ,"KOI8_R" });
4250// If the database isn't encoding-aware then we can't have
4351// any preferred encodings.
4452encodings .put ("UNKNOWN" ,new String [0 ]);
53+ // The following encodings do not have a java equivalent
54+ encodings .put ("MULE_INTERNAL" ,new String [0 ]);
55+ encodings .put ("LATIN6" ,new String [0 ]);
56+ encodings .put ("LATIN8" ,new String [0 ]);
57+ encodings .put ("LATIN10" ,new String [0 ]);
4558 }
4659
4760private final String encoding ;