Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / libjava / gnu / gcj / convert / IOConverter.java
bloba0d46677670a52506627aeb71aa88130883f27d6
1 /* Copyright (C) 2000, 2001, 2005 Free Software Foundation
3 This file is part of libgcj.
5 This software is copyrighted work licensed under the terms of the
6 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
7 details. */
9 /* This is a base class that handles aliasing issues for
10 UnicodeToBytes to BytesToUnicode. */
12 package gnu.gcj.convert;
14 import java.util.Hashtable;
16 public abstract class IOConverter
18 // Map encoding aliases to our canonical form.
19 static private Hashtable hash = new Hashtable ();
21 // True if we have to do byte-order conversions on iconv()
22 // arguments.
23 static protected boolean iconv_byte_swap;
25 static
27 // Manually maintained aliases. Note that the value must be our
28 // canonical name.
29 hash.put ("iso-latin-1", "8859_1");
30 hash.put ("iso8859_1", "8859_1");
31 hash.put ("utf-16le", "UnicodeLittle");
32 hash.put ("utf-16be", "UnicodeBig");
33 // At least one build script out there uses 'utf8'.
34 hash.put ("utf8", "UTF8");
35 // On Solaris the default encoding, as returned by nl_langinfo(),
36 // is `646' (aka ASCII), but the Solaris iconv_open() doesn't
37 // understand that. We work around the problem by adding an
38 // explicit alias for Solaris users.
39 hash.put ("646", "ASCII");
41 // See PR 24552, PR 14358.
42 hash.put ("euc_jp", "EUCJIS");
43 hash.put ("eucjp", "EUCJIS");
45 // All aliases after this point are automatically generated by the
46 // `encodings.pl' script. Run it to make any corrections.
47 hash.put ("ansi_x3.4-1968", "ASCII");
48 hash.put ("ansi_x3.4-1986", "ASCII");
49 hash.put ("ascii", "ASCII");
50 hash.put ("cp367", "ASCII");
51 hash.put ("cp819", "8859_1");
52 hash.put ("csascii", "ASCII");
53 hash.put ("cseucpkdfmtjapanese", "EUCJIS");
54 hash.put ("csisolatin1", "8859_1");
55 hash.put ("csshiftjis", "SJIS");
56 hash.put ("euc-jp", "EUCJIS");
57 hash.put ("extended_unix_code_packed_format_for_japanese", "EUCJIS");
58 hash.put ("ibm367", "ASCII");
59 hash.put ("ibm819", "8859_1");
60 hash.put ("iso-8859-1", "8859_1");
61 hash.put ("iso-ir-100", "8859_1");
62 hash.put ("iso-ir-6", "ASCII");
63 hash.put ("iso646-us", "ASCII");
64 hash.put ("iso_646.irv:1991", "ASCII");
65 hash.put ("iso_8859-1", "8859_1");
66 hash.put ("iso_8859-1:1987", "8859_1");
67 hash.put ("l1", "8859_1");
68 hash.put ("latin1", "8859_1");
69 hash.put ("ms_kanji", "SJIS");
70 hash.put ("shift_jis", "SJIS");
71 hash.put ("us", "ASCII");
72 hash.put ("us-ascii", "ASCII");
73 hash.put ("utf-8", "UTF8");
74 hash.put ("utf16-be", "UnicodeBig");
75 hash.put ("utf16-le", "UnicodeLittle");
76 // End script-generated section.
78 iconv_byte_swap = iconv_init ();
81 private static native boolean iconv_init ();
83 // Turn an alias into the canonical form.
84 protected static final String canonicalize (String name)
86 String c = (String) hash.get (name.toLowerCase ());
87 return c == null ? name : c;