>From d10d9f0f571cdfc3a5590abc8ca9e94d08862591 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 20 May 2018 01:37:22 +0200 Subject: [PATCH 4/5] localcharset: Map the locale encodings found in newer OSes. * lib/localcharset.c (alias_table): Add mapping for locale encodings found in FreeBSD 11, NetBSD 7, Solaris 10, Openindiana, HP-UX 11.31, IRIX 6.5, Minix 3.3. * lib/localcharset.h: Update comments accordingly. Also for Cygwin 2.9. --- ChangeLog | 8 +++++++ lib/localcharset.c | 66 +++++++++++++++++++++++++++++++++++++++++++++--------- lib/localcharset.h | 32 +++++++++++++------------- 3 files changed, 79 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index ad2e064..8a02c1a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2018-05-19 Bruno Haible + localcharset: Map the locale encodings found in newer OSes. + * lib/localcharset.c (alias_table): Add mapping for locale encodings + found in FreeBSD 11, NetBSD 7, Solaris 10, Openindiana, HP-UX 11.31, + IRIX 6.5, Minix 3.3. + * lib/localcharset.h: Update comments accordingly. Also for Cygwin 2.9. + +2018-05-19 Bruno Haible + localcharset: Move mapping tables into the code. Use a binary search. * lib/localcharset.h: Document the GNU canonical names for character encodings here. diff --git a/lib/localcharset.c b/lib/localcharset.c index 94e0f8a..60c320a 100644 --- a/lib/localcharset.c +++ b/lib/localcharset.c @@ -90,13 +90,41 @@ struct table_entry static const struct table_entry alias_table[] = { # if defined __FreeBSD__ /* FreeBSD */ - { "C", "ASCII" }, - { "US-ASCII", "ASCII" } + { "ARMSCII-8", "ARMSCII-8" }, + { "Big5", "BIG5" }, + { "C", "ASCII" }, + { "CP1131", "CP1131" }, + { "CP1251", "CP1251" }, + { "CP866", "CP866" }, + { "GB18030", "GB18030" }, + { "GB2312", "GB2312" }, + { "GBK", "GBK" }, + /*{ "ISCII-DEV", "?" },*/ + { "ISO8859-1", "ISO-8859-1" }, + { "ISO8859-13", "ISO-8859-13" }, + { "ISO8859-15", "ISO-8859-15" }, + { "ISO8859-2", "ISO-8859-2" }, + { "ISO8859-5", "ISO-8859-5" }, + { "ISO8859-7", "ISO-8859-7" }, + { "ISO8859-9", "ISO-8859-9" }, + { "KOI8-R", "KOI8-R" }, + { "KOI8-U", "KOI8-U" }, + { "SJIS", "SHIFT_JIS" }, + { "US-ASCII", "ASCII" }, + { "eucCN", "GB2312" }, + { "eucJP", "EUC-JP" }, + { "eucKR", "EUC-KR" } # define alias_table_defined # endif # if defined __NetBSD__ /* NetBSD */ { "646", "ASCII" }, + { "ARMSCII-8", "ARMSCII-8" }, { "BIG5", "BIG5" }, + { "Big5-HKSCS", "BIG5-HKSCS" }, + { "CP1251", "CP1251" }, + { "CP866", "CP866" }, + { "GB18030", "GB18030" }, + { "GB2312", "GB2312" }, { "ISO8859-1", "ISO-8859-1" }, { "ISO8859-13", "ISO-8859-13" }, { "ISO8859-15", "ISO-8859-15" }, @@ -104,6 +132,9 @@ static const struct table_entry alias_table[] = { "ISO8859-4", "ISO-8859-4" }, { "ISO8859-5", "ISO-8859-5" }, { "ISO8859-7", "ISO-8859-7" }, + { "KOI8-R", "KOI8-R" }, + { "KOI8-U", "KOI8-U" }, + { "PT154", "PT154" }, { "SJIS", "SHIFT_JIS" }, { "eucCN", "GB2312" }, { "eucJP", "EUC-JP" }, @@ -217,21 +248,27 @@ static const struct table_entry alias_table[] = { "SJIS", "SHIFT_JIS" }, { "arabic8", "HP-ARABIC8" }, { "big5", "BIG5" }, + { "cp1251", "CP1251" }, { "eucJP", "EUC-JP" }, { "eucKR", "EUC-KR" }, { "eucTW", "EUC-TW" }, + { "gb18030", "GB18030" }, { "greek8", "HP-GREEK8" }, { "hebrew8", "HP-HEBREW8" }, + { "hkbig5", "BIG5-HKSCS" }, { "hp15CN", "GB2312" }, { "iso88591", "ISO-8859-1" }, + { "iso885913", "ISO-8859-13" }, { "iso885915", "ISO-8859-15" }, { "iso88592", "ISO-8859-2" }, + { "iso88594", "ISO-8859-4" }, { "iso88595", "ISO-8859-5" }, { "iso88596", "ISO-8859-6" }, { "iso88597", "ISO-8859-7" }, { "iso88598", "ISO-8859-8" }, { "iso88599", "ISO-8859-9" }, { "kana8", "HP-KANA8" }, + { "koi8r", "KOI8-R" }, { "roman8", "HP-ROMAN8" }, { "tis620", "TIS-620" }, { "turkish8", "HP-TURKISH8" }, @@ -239,15 +276,16 @@ static const struct table_entry alias_table[] = # define alias_table_defined # endif # if defined __sgi /* IRIX */ - { "ISO8859-1", "ISO-8859-1" }, - { "ISO8859-2", "ISO-8859-2" }, - { "ISO8859-5", "ISO-8859-5" }, - { "ISO8859-7", "ISO-8859-7" }, - { "ISO8859-9", "ISO-8859-9" }, - { "eucCN", "GB2312" }, - { "eucJP", "EUC-JP" }, - { "eucKR", "EUC-KR" }, - { "eucTW", "EUC-TW" } + { "ISO8859-1", "ISO-8859-1" }, + { "ISO8859-15", "ISO-8859-15" }, + { "ISO8859-2", "ISO-8859-2" }, + { "ISO8859-5", "ISO-8859-5" }, + { "ISO8859-7", "ISO-8859-7" }, + { "ISO8859-9", "ISO-8859-9" }, + { "eucCN", "GB2312" }, + { "eucJP", "EUC-JP" }, + { "eucKR", "EUC-KR" }, + { "eucTW", "EUC-TW" } # define alias_table_defined # endif # if defined __osf__ /* OSF/1 */ @@ -284,6 +322,8 @@ static const struct table_entry alias_table[] = { "GB18030", "GB18030" }, { "GBK", "GBK" }, { "ISO8859-1", "ISO-8859-1" }, + { "ISO8859-11", "TIS-620" }, + { "ISO8859-13", "ISO-8859-13" }, { "ISO8859-15", "ISO-8859-15" }, { "ISO8859-2", "ISO-8859-2" }, { "ISO8859-3", "ISO-8859-3" }, @@ -303,6 +343,10 @@ static const struct table_entry alias_table[] = { "koi8-r", "KOI8-R" } # define alias_table_defined # endif +# if defined __minix /* Minix */ + { "646", "ASCII" } +# define alias_table_defined +# endif # if defined WINDOWS_NATIVE || defined __CYGWIN__ /* Windows */ { "CP1361", "JOHAB" }, { "CP20127", "ASCII" }, diff --git a/lib/localcharset.h b/lib/localcharset.h index 56d5aaa..3a10f69 100644 --- a/lib/localcharset.h +++ b/lib/localcharset.h @@ -44,20 +44,20 @@ extern const char * locale_charset (void); name MIME? used by which systems (darwin = Mac OS X, windows = native Windows) - ASCII, ANSI_X3.4-1968 glibc solaris freebsd netbsd darwin cygwin + ASCII, ANSI_X3.4-1968 glibc solaris freebsd netbsd darwin minix cygwin ISO-8859-1 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin ISO-8859-2 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin ISO-8859-3 Y glibc solaris cygwin - ISO-8859-4 Y osf solaris freebsd netbsd openbsd darwin + ISO-8859-4 Y hpux osf solaris freebsd netbsd openbsd darwin ISO-8859-5 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin ISO-8859-6 Y glibc aix hpux solaris cygwin - ISO-8859-7 Y glibc aix hpux irix osf solaris netbsd openbsd darwin cygwin + ISO-8859-7 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin ISO-8859-8 Y glibc aix hpux osf solaris cygwin - ISO-8859-9 Y glibc aix hpux irix osf solaris darwin cygwin - ISO-8859-13 glibc netbsd openbsd darwin cygwin + ISO-8859-9 Y glibc aix hpux irix osf solaris freebsd darwin cygwin + ISO-8859-13 glibc hpux solaris freebsd netbsd openbsd darwin cygwin ISO-8859-14 glibc cygwin - ISO-8859-15 glibc aix osf solaris freebsd netbsd openbsd darwin cygwin - KOI8-R Y glibc solaris freebsd netbsd openbsd darwin + ISO-8859-15 glibc aix irix osf solaris freebsd netbsd openbsd darwin cygwin + KOI8-R Y glibc hpux solaris freebsd netbsd openbsd darwin KOI8-U Y glibc freebsd netbsd openbsd darwin cygwin KOI8-T glibc CP437 dos @@ -83,31 +83,31 @@ extern const char * locale_charset (void); CP1124 aix CP1125 dos CP1129 aix - CP1131 darwin + CP1131 freebsd darwin CP1250 windows - CP1251 glibc solaris netbsd openbsd darwin cygwin windows + CP1251 glibc hpux solaris freebsd netbsd openbsd darwin cygwin windows CP1252 aix windows CP1253 windows CP1254 windows CP1255 glibc windows CP1256 windows CP1257 windows - GB2312 Y glibc aix hpux irix solaris freebsd netbsd darwin - EUC-JP Y glibc aix hpux irix osf solaris freebsd netbsd darwin + GB2312 Y glibc aix hpux irix solaris freebsd netbsd darwin cygwin + EUC-JP Y glibc aix hpux irix osf solaris freebsd netbsd darwin cygwin EUC-KR Y glibc aix hpux irix osf solaris freebsd netbsd darwin cygwin EUC-TW glibc aix hpux irix osf solaris netbsd BIG5 Y glibc aix hpux osf solaris freebsd netbsd darwin cygwin - BIG5-HKSCS glibc solaris darwin - GBK glibc aix osf solaris darwin cygwin windows dos - GB18030 glibc solaris netbsd darwin + BIG5-HKSCS glibc hpux solaris netbsd darwin + GBK glibc aix osf solaris freebsd darwin cygwin windows dos + GB18030 glibc hpux solaris freebsd netbsd darwin SHIFT_JIS Y hpux osf solaris freebsd netbsd darwin JOHAB glibc solaris windows TIS-620 glibc aix hpux osf solaris cygwin VISCII Y glibc TCVN5712-1 glibc - ARMSCII-8 glibc darwin + ARMSCII-8 glibc freebsd netbsd darwin GEORGIAN-PS glibc cygwin - PT154 glibc + PT154 glibc netbsd cygwin HP-ROMAN8 hpux HP-ARABIC8 hpux HP-GREEK8 hpux -- 2.7.4