summaryrefslogtreecommitdiff
path: root/libjava/gnu/gcj/convert/IOConverter.java
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2000-08-02 19:56:53 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2000-08-02 19:56:53 +0000
commit65d0fdfa264aefe3cd73493b55afca39b87811be (patch)
tree0c8d1667b236d225c6148e9a0990ef2a665f3fca /libjava/gnu/gcj/convert/IOConverter.java
parentb191757f46ea30f632549b944c252fcccdc46ba5 (diff)
downloadgcc-65d0fdfa264aefe3cd73493b55afca39b87811be.tar.gz
* scripts/encodings.pl: New file.
* Makefile.in: Rebuilt. * Makefile.am (convert_source_files): Added IOConverter.java. * gnu/gcj/convert/UnicodeToBytes.java (UnicodeToBytes): Extend IOConverter. (getDefaultDecodingClass): Canonicalize default encoding name. (getEncoder): Likewise. * gnu/gcj/convert/BytesToUnicode.java (BytesToUnicode): Extend IOConverter. (getDefaultDecodingClass): Canonicalize default encoding name. (getDecoder): Likewise. * gnu/gcj/convert/IOConverter.java: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35432 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/gnu/gcj/convert/IOConverter.java')
-rw-r--r--libjava/gnu/gcj/convert/IOConverter.java52
1 files changed, 52 insertions, 0 deletions
diff --git a/libjava/gnu/gcj/convert/IOConverter.java b/libjava/gnu/gcj/convert/IOConverter.java
new file mode 100644
index 00000000000..c98662485b6
--- /dev/null
+++ b/libjava/gnu/gcj/convert/IOConverter.java
@@ -0,0 +1,52 @@
+/* Copyright (C) 2000 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+/* This is a base class that handles aliasing issues for
+ UnicodeToBytes to BytesToUnicode. */
+
+package gnu.gcj.convert;
+
+import java.util.Hashtable;
+
+public abstract class IOConverter
+{
+ // Map encoding aliases to our canonical form.
+ static private Hashtable hash = new Hashtable ();
+
+ static
+ {
+ // Manually maintained aliases. Note that the value must be our
+ // canonical name.
+ hash.put ("ISO-Latin-1", "8859_1");
+ // All aliases after this point are automatically generated by the
+ // `encodings.pl' script. Run it to make any corrections.
+ hash.put ("ISO_8859-1:1987", "8859_1");
+ hash.put ("iso-ir-100", "8859_1");
+ hash.put ("ISO_8859-1", "8859_1");
+ hash.put ("ISO-8859-1", "8859_1");
+ hash.put ("latin1", "8859_1");
+ hash.put ("l1", "8859_1");
+ hash.put ("IBM819", "8859_1");
+ hash.put ("CP819", "8859_1");
+ hash.put ("csISOLatin1", "8859_1");
+ hash.put ("UTF-8", "UTF8");
+ hash.put ("Shift_JIS", "SJIS");
+ hash.put ("MS_Kanji", "SJIS");
+ hash.put ("csShiftJIS", "SJIS");
+ hash.put ("Extended_UNIX_Code_Packed_Format_for_Japanese", "EUCJIS");
+ hash.put ("csEUCPkdFmtJapanese", "EUCJIS");
+ hash.put ("EUC-JP", "EUCJIS");
+ }
+
+ // Turn an alias into the canonical form.
+ protected static final String canonicalize (String name)
+ {
+ String c = (String) hash.get (name);
+ return c == null ? name : c;
+ }
+}