diff options
-rw-r--r-- | intl/ChangeLog | 5 | ||||
-rwxr-xr-x | intl/config.charset | 234 | ||||
-rw-r--r-- | intl/localcharset.c | 17 | ||||
-rw-r--r-- | lib/ChangeLog | 5 | ||||
-rwxr-xr-x | lib/config.charset | 234 | ||||
-rw-r--r-- | lib/localcharset.c | 17 |
6 files changed, 460 insertions, 52 deletions
diff --git a/intl/ChangeLog b/intl/ChangeLog index 8834cc3..a562850 100644 --- a/intl/ChangeLog +++ b/intl/ChangeLog @@ -1,3 +1,8 @@ +2001-03-09 Bruno Haible <haible@clisp.cons.org> + + * config.charset: Update from libiconv-1.6. + * localcharset.c: Likewise. + 2001-02-25 Ulrich Drepper <drepper@redhat.com> * locale.alias: Don't use nb_NO but define aliases for it. diff --git a/intl/config.charset b/intl/config.charset index bf21d99..0844094 100755 --- a/intl/config.charset +++ b/intl/config.charset @@ -33,27 +33,37 @@ # name used by which systems a MIME name? # ASCII, ANSI_X3.4-1968 glibc solaris freebsd # ISO-8859-1 glibc aix hpux irix osf solaris freebsd yes -# ISO-8859-2 glibc aix hpux irix solaris freebsd yes +# ISO-8859-2 glibc aix hpux irix osf solaris freebsd yes # ISO-8859-3 glibc yes -# ISO-8859-4 solaris freebsd yes -# ISO-8859-5 glibc aix hpux irix solaris freebsd yes +# ISO-8859-4 osf solaris freebsd yes +# ISO-8859-5 glibc aix hpux irix osf solaris freebsd yes # ISO-8859-6 glibc aix hpux solaris yes # ISO-8859-7 glibc aix hpux irix osf solaris yes -# ISO-8859-8 glibc aix hpux solaris yes +# ISO-8859-8 glibc aix hpux osf solaris yes # ISO-8859-9 glibc aix hpux irix osf solaris yes # ISO-8859-13 glibc -# ISO-8859-15 glibc aix solaris freebsd +# ISO-8859-15 glibc aix osf solaris freebsd # KOI8-R glibc solaris freebsd yes # KOI8-U glibc freebsd yes -# CP850 aix osf +# CP437 dos +# CP775 dos +# CP850 aix osf dos +# CP852 dos +# CP855 dos # CP856 aix -# CP866 freebsd -# CP874 win32 +# CP857 dos +# CP861 dos +# CP862 dos +# CP864 dos +# CP865 dos +# CP866 freebsd dos +# CP869 dos +# CP874 win32 dos # CP922 aix -# CP932 aix win32 +# CP932 aix win32 dos # CP943 aix -# CP949 win32 -# CP950 win32 +# CP949 osf win32 dos +# CP950 win32 dos # CP1046 aix # CP1124 aix # CP1129 aix @@ -66,16 +76,16 @@ # CP1256 win32 # CP1257 win32 # GB2312 glibc aix hpux irix solaris freebsd yes -# EUC-JP glibc aix hpux irix solaris freebsd yes -# EUC-KR glibc aix hpux irix solaris freebsd yes -# EUC-TW glibc aix hpux irix solaris -# BIG5 glibc aix hpux solaris freebsd yes +# EUC-JP glibc aix hpux irix osf solaris freebsd yes +# EUC-KR glibc aix hpux irix osf solaris freebsd yes +# EUC-TW glibc aix hpux irix osf solaris +# BIG5 glibc aix hpux osf solaris freebsd yes # BIG5HKSCS glibc -# GBK aix win32 +# GBK aix osf win32 dos # GB18030 glibc -# SJIS hpux solaris freebsd +# SJIS hpux osf solaris freebsd # JOHAB glibc win32 -# TIS-620 glibc aix hpux solaris +# TIS-620 glibc aix hpux osf solaris # VISCII glibc yes # HP-ROMAN8 hpux # HP-ARABIC8 hpux @@ -83,7 +93,9 @@ # HP-HEBREW8 hpux # HP-TURKISH8 hpux # HP-KANA8 hpux -# UTF-8 glibc aix hpux solaris yes +# DEC-KANJI osf +# DEC-HANYU osf +# UTF-8 glibc aix hpux osf solaris yes # # Note: Names which are not marked as being a MIME name should not be used in # Internet protocols for information interchange (mail, news, etc.). @@ -178,9 +190,28 @@ case "$os" in ;; osf*) echo "ISO8859-1 ISO-8859-1" + echo "ISO8859-2 ISO-8859-2" + echo "ISO8859-4 ISO-8859-4" + echo "ISO8859-5 ISO-8859-5" echo "ISO8859-7 ISO-8859-7" + echo "ISO8859-8 ISO-8859-8" echo "ISO8859-9 ISO-8859-9" + echo "ISO8859-15 ISO-8859-15" echo "cp850 CP850" + echo "big5 BIG5" + echo "dechanyu DEC-HANYU" + echo "dechanzi GB2312" + echo "deckanji DEC-KANJI" + echo "deckorean EUC-KR" + echo "eucJP EUC-JP" + echo "eucKR EUC-KR" + echo "eucTW EUC-TW" + echo "GBK GBK" + echo "KSC5601 CP949" + echo "sdeckanji EUC-JP" + echo "SJIS SJIS" + echo "TACTIS TIS-620" + echo "UTF-8 UTF-8" ;; solaris*) echo "646 ASCII" @@ -214,8 +245,8 @@ case "$os" in echo "$l.ASCII ASCII" done for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \ - fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT la_LN \ - lt_LN nl_BE nl_NL no_NO pt_PT sv_SE; do + fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT la_LN \ + lt_LN nl_BE nl_NL no_NO pt_PT sv_SE; do echo "$l.ISO_8859-1 ISO-8859-1" echo "$l.DIS_8859-15 ISO-8859-15" done @@ -243,4 +274,165 @@ case "$os" in # BeOS has a single locale, and it has UTF-8 encoding. echo "C UTF-8" ;; + msdosdjgpp*) + # DJGPP 2.03 doesn't have nl_langinfo(CODESET); therefore + # localcharset.c falls back to using the full locale name + # from the environment variables. + echo "#" + echo "# The encodings given here may not all be correct." + echo "# If you find that the encoding given for your language and" + echo "# country is not the one your DOS machine actually uses, just" + echo "# correct it in this file, and send a mail to" + echo "# Juan Manuel Guerrero <st001906@hrz1.hrz.tu-darmstadt.de>" + echo "# and Bruno Haible <haible@clisp.cons.org>." + echo "#" + echo "C ASCII" + # ISO-8859-1 languages + echo "ca CP850" + echo "ca_ES CP850" + echo "da CP865" # not CP850 ?? + echo "da_DK CP865" # not CP850 ?? + echo "de CP850" + echo "de_AT CP850" + echo "de_CH CP850" + echo "de_DE CP850" + echo "en CP850" + echo "en_AU CP850" # not CP437 ?? + echo "en_CA CP850" + echo "en_GB CP850" + echo "en_NZ CP437" + echo "en_US CP437" + echo "en_ZA CP850" # not CP437 ?? + echo "es CP850" + echo "es_AR CP850" + echo "es_BO CP850" + echo "es_CL CP850" + echo "es_CO CP850" + echo "es_CR CP850" + echo "es_CU CP850" + echo "es_DO CP850" + echo "es_EC CP850" + echo "es_ES CP850" + echo "es_GT CP850" + echo "es_HN CP850" + echo "es_MX CP850" + echo "es_NI CP850" + echo "es_PA CP850" + echo "es_PY CP850" + echo "es_PE CP850" + echo "es_SV CP850" + echo "es_UY CP850" + echo "es_VE CP850" + echo "et CP850" + echo "et_EE CP850" + echo "eu CP850" + echo "eu_ES CP850" + echo "fi CP850" + echo "fi_FI CP850" + echo "fr CP850" + echo "fr_BE CP850" + echo "fr_CA CP850" + echo "fr_CH CP850" + echo "fr_FR CP850" + echo "ga CP850" + echo "ga_IE CP850" + echo "gd CP850" + echo "gd_GB CP850" + echo "gl CP850" + echo "gl_ES CP850" + echo "id CP850" # not CP437 ?? + echo "id_ID CP850" # not CP437 ?? + echo "is CP861" # not CP850 ?? + echo "is_IS CP861" # not CP850 ?? + echo "it CP850" + echo "it_CH CP850" + echo "it_IT CP850" + echo "lt CP775" + echo "lt_LT CP775" + echo "lv CP775" + echo "lv_LV CP775" + echo "nb CP865" # not CP850 ?? + echo "nb_NO CP865" # not CP850 ?? + echo "nl CP850" + echo "nl_BE CP850" + echo "nl_NL CP850" + echo "nn CP865" # not CP850 ?? + echo "nn_NO CP865" # not CP850 ?? + echo "no CP865" # not CP850 ?? + echo "no_NO CP865" # not CP850 ?? + echo "pt CP850" + echo "pt_BR CP850" + echo "pt_PT CP850" + echo "sv CP850" + echo "sv_SE CP850" + # ISO-8859-2 languages + echo "cs CP852" + echo "cs_CZ CP852" + echo "hr CP852" + echo "hr_HR CP852" + echo "hu CP852" + echo "hu_HU CP852" + echo "pl CP852" + echo "pl_PL CP852" + echo "ro CP852" + echo "ro_RO CP852" + echo "sk CP852" + echo "sk_SK CP852" + echo "sl CP852" + echo "sl_SI CP852" + echo "sq CP852" + echo "sq_AL CP852" + echo "sr CP852" # CP852 or CP866 or CP855 ?? + echo "sr_YU CP852" # CP852 or CP866 or CP855 ?? + # ISO-8859-3 languages + echo "mt CP850" + echo "mt_MT CP850" + # ISO-8859-5 languages + echo "be CP866" + echo "be_BE CP866" + echo "bg CP866" # not CP855 ?? + echo "bg_BG CP866" # not CP855 ?? + echo "mk CP866" # not CP855 ?? + echo "mk_MK CP866" # not CP855 ?? + echo "ru KOI8-R" # not CP866 ?? + echo "ru_RU KOI8-R" # not CP866 ?? + # ISO-8859-6 languages + echo "ar CP864" + echo "ar_AE CP864" + echo "ar_DZ CP864" + echo "ar_EG CP864" + echo "ar_IQ CP864" + echo "ar_IR CP864" + echo "ar_JO CP864" + echo "ar_KW CP864" + echo "ar_MA CP864" + echo "ar_OM CP864" + echo "ar_QA CP864" + echo "ar_SA CP864" + echo "ar_SY CP864" + # ISO-8859-7 languages + echo "el CP869" + echo "el_GR CP869" + # ISO-8859-8 languages + echo "he CP862" + echo "he_IL CP862" + # ISO-8859-9 languages + echo "tr CP857" + echo "tr_TR CP857" + # Japanese + echo "ja CP932" + echo "ja_JP CP932" + # Chinese + echo "zh_CN GBK" + echo "zh_TW CP950" # not CP938 ?? + # Korean + echo "kr CP949" # not CP934 ?? + echo "kr_KR CP949" # not CP934 ?? + # Thai + echo "th CP874" + echo "th_TH CP874" + # Other + echo "eo CP850" + echo "eo_EO CP850" + ;; esac diff --git a/intl/localcharset.c b/intl/localcharset.c index 12214b7..201483c 100644 --- a/intl/localcharset.c +++ b/intl/localcharset.c @@ -1,6 +1,6 @@ /* Determine a canonical name for the current locale's character encoding. - Copyright (C) 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 2000-2001 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published @@ -194,7 +194,7 @@ get_charset_aliases () into one of the canonical names listed in config.charset. The result must not be freed; it is statically allocated. If the canonical name cannot be determined, the result is a non-canonical - name or NULL. */ + name. */ #ifdef STATIC STATIC @@ -214,10 +214,14 @@ locale_charset () # else - /* On old systems which lack it, use setlocale and getenv. */ + /* On old systems which lack it, use setlocale or getenv. */ const char *locale = NULL; -# if HAVE_SETLOCALE + /* But most old systems don't have a complete set of locales. Some + (like SunOS 4 or DJGPP) have only the C locale. Therefore we don't + use setlocale here; it would return "C" when it doesn't support the + locale name the user has set. */ +# if HAVE_SETLOCALE && 0 locale = setlocale (LC_CTYPE, NULL); # endif if (locale == NULL || locale[0] == '\0') @@ -248,7 +252,10 @@ locale_charset () #endif - if (codeset != NULL && codeset[0] != '\0') + if (codeset == NULL) + /* The canonical name cannot be determined. */ + codeset = ""; + else if (codeset[0] != '\0') { /* Resolve alias. */ for (aliases = get_charset_aliases (); diff --git a/lib/ChangeLog b/lib/ChangeLog index 6dc88b5..97cc9ad 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,8 @@ +2001-03-09 Bruno Haible <haible@clisp.cons.org> + + * config.charset: Update from libiconv-1.6. + * localcharset.c: Likewise. + 2001-03-04 Bruno Haible <haible@clisp.cons.org> * system.h (ISSLASH, HAS_DEVICE, IS_ABSOLUTE_PATH, IS_PATH_WITH_DIR, diff --git a/lib/config.charset b/lib/config.charset index bf21d99..0844094 100755 --- a/lib/config.charset +++ b/lib/config.charset @@ -33,27 +33,37 @@ # name used by which systems a MIME name? # ASCII, ANSI_X3.4-1968 glibc solaris freebsd # ISO-8859-1 glibc aix hpux irix osf solaris freebsd yes -# ISO-8859-2 glibc aix hpux irix solaris freebsd yes +# ISO-8859-2 glibc aix hpux irix osf solaris freebsd yes # ISO-8859-3 glibc yes -# ISO-8859-4 solaris freebsd yes -# ISO-8859-5 glibc aix hpux irix solaris freebsd yes +# ISO-8859-4 osf solaris freebsd yes +# ISO-8859-5 glibc aix hpux irix osf solaris freebsd yes # ISO-8859-6 glibc aix hpux solaris yes # ISO-8859-7 glibc aix hpux irix osf solaris yes -# ISO-8859-8 glibc aix hpux solaris yes +# ISO-8859-8 glibc aix hpux osf solaris yes # ISO-8859-9 glibc aix hpux irix osf solaris yes # ISO-8859-13 glibc -# ISO-8859-15 glibc aix solaris freebsd +# ISO-8859-15 glibc aix osf solaris freebsd # KOI8-R glibc solaris freebsd yes # KOI8-U glibc freebsd yes -# CP850 aix osf +# CP437 dos +# CP775 dos +# CP850 aix osf dos +# CP852 dos +# CP855 dos # CP856 aix -# CP866 freebsd -# CP874 win32 +# CP857 dos +# CP861 dos +# CP862 dos +# CP864 dos +# CP865 dos +# CP866 freebsd dos +# CP869 dos +# CP874 win32 dos # CP922 aix -# CP932 aix win32 +# CP932 aix win32 dos # CP943 aix -# CP949 win32 -# CP950 win32 +# CP949 osf win32 dos +# CP950 win32 dos # CP1046 aix # CP1124 aix # CP1129 aix @@ -66,16 +76,16 @@ # CP1256 win32 # CP1257 win32 # GB2312 glibc aix hpux irix solaris freebsd yes -# EUC-JP glibc aix hpux irix solaris freebsd yes -# EUC-KR glibc aix hpux irix solaris freebsd yes -# EUC-TW glibc aix hpux irix solaris -# BIG5 glibc aix hpux solaris freebsd yes +# EUC-JP glibc aix hpux irix osf solaris freebsd yes +# EUC-KR glibc aix hpux irix osf solaris freebsd yes +# EUC-TW glibc aix hpux irix osf solaris +# BIG5 glibc aix hpux osf solaris freebsd yes # BIG5HKSCS glibc -# GBK aix win32 +# GBK aix osf win32 dos # GB18030 glibc -# SJIS hpux solaris freebsd +# SJIS hpux osf solaris freebsd # JOHAB glibc win32 -# TIS-620 glibc aix hpux solaris +# TIS-620 glibc aix hpux osf solaris # VISCII glibc yes # HP-ROMAN8 hpux # HP-ARABIC8 hpux @@ -83,7 +93,9 @@ # HP-HEBREW8 hpux # HP-TURKISH8 hpux # HP-KANA8 hpux -# UTF-8 glibc aix hpux solaris yes +# DEC-KANJI osf +# DEC-HANYU osf +# UTF-8 glibc aix hpux osf solaris yes # # Note: Names which are not marked as being a MIME name should not be used in # Internet protocols for information interchange (mail, news, etc.). @@ -178,9 +190,28 @@ case "$os" in ;; osf*) echo "ISO8859-1 ISO-8859-1" + echo "ISO8859-2 ISO-8859-2" + echo "ISO8859-4 ISO-8859-4" + echo "ISO8859-5 ISO-8859-5" echo "ISO8859-7 ISO-8859-7" + echo "ISO8859-8 ISO-8859-8" echo "ISO8859-9 ISO-8859-9" + echo "ISO8859-15 ISO-8859-15" echo "cp850 CP850" + echo "big5 BIG5" + echo "dechanyu DEC-HANYU" + echo "dechanzi GB2312" + echo "deckanji DEC-KANJI" + echo "deckorean EUC-KR" + echo "eucJP EUC-JP" + echo "eucKR EUC-KR" + echo "eucTW EUC-TW" + echo "GBK GBK" + echo "KSC5601 CP949" + echo "sdeckanji EUC-JP" + echo "SJIS SJIS" + echo "TACTIS TIS-620" + echo "UTF-8 UTF-8" ;; solaris*) echo "646 ASCII" @@ -214,8 +245,8 @@ case "$os" in echo "$l.ASCII ASCII" done for l in da_DK de_AT de_CH de_DE en_AU en_CA en_GB en_US es_ES \ - fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT la_LN \ - lt_LN nl_BE nl_NL no_NO pt_PT sv_SE; do + fi_FI fr_BE fr_CA fr_CH fr_FR is_IS it_CH it_IT la_LN \ + lt_LN nl_BE nl_NL no_NO pt_PT sv_SE; do echo "$l.ISO_8859-1 ISO-8859-1" echo "$l.DIS_8859-15 ISO-8859-15" done @@ -243,4 +274,165 @@ case "$os" in # BeOS has a single locale, and it has UTF-8 encoding. echo "C UTF-8" ;; + msdosdjgpp*) + # DJGPP 2.03 doesn't have nl_langinfo(CODESET); therefore + # localcharset.c falls back to using the full locale name + # from the environment variables. + echo "#" + echo "# The encodings given here may not all be correct." + echo "# If you find that the encoding given for your language and" + echo "# country is not the one your DOS machine actually uses, just" + echo "# correct it in this file, and send a mail to" + echo "# Juan Manuel Guerrero <st001906@hrz1.hrz.tu-darmstadt.de>" + echo "# and Bruno Haible <haible@clisp.cons.org>." + echo "#" + echo "C ASCII" + # ISO-8859-1 languages + echo "ca CP850" + echo "ca_ES CP850" + echo "da CP865" # not CP850 ?? + echo "da_DK CP865" # not CP850 ?? + echo "de CP850" + echo "de_AT CP850" + echo "de_CH CP850" + echo "de_DE CP850" + echo "en CP850" + echo "en_AU CP850" # not CP437 ?? + echo "en_CA CP850" + echo "en_GB CP850" + echo "en_NZ CP437" + echo "en_US CP437" + echo "en_ZA CP850" # not CP437 ?? + echo "es CP850" + echo "es_AR CP850" + echo "es_BO CP850" + echo "es_CL CP850" + echo "es_CO CP850" + echo "es_CR CP850" + echo "es_CU CP850" + echo "es_DO CP850" + echo "es_EC CP850" + echo "es_ES CP850" + echo "es_GT CP850" + echo "es_HN CP850" + echo "es_MX CP850" + echo "es_NI CP850" + echo "es_PA CP850" + echo "es_PY CP850" + echo "es_PE CP850" + echo "es_SV CP850" + echo "es_UY CP850" + echo "es_VE CP850" + echo "et CP850" + echo "et_EE CP850" + echo "eu CP850" + echo "eu_ES CP850" + echo "fi CP850" + echo "fi_FI CP850" + echo "fr CP850" + echo "fr_BE CP850" + echo "fr_CA CP850" + echo "fr_CH CP850" + echo "fr_FR CP850" + echo "ga CP850" + echo "ga_IE CP850" + echo "gd CP850" + echo "gd_GB CP850" + echo "gl CP850" + echo "gl_ES CP850" + echo "id CP850" # not CP437 ?? + echo "id_ID CP850" # not CP437 ?? + echo "is CP861" # not CP850 ?? + echo "is_IS CP861" # not CP850 ?? + echo "it CP850" + echo "it_CH CP850" + echo "it_IT CP850" + echo "lt CP775" + echo "lt_LT CP775" + echo "lv CP775" + echo "lv_LV CP775" + echo "nb CP865" # not CP850 ?? + echo "nb_NO CP865" # not CP850 ?? + echo "nl CP850" + echo "nl_BE CP850" + echo "nl_NL CP850" + echo "nn CP865" # not CP850 ?? + echo "nn_NO CP865" # not CP850 ?? + echo "no CP865" # not CP850 ?? + echo "no_NO CP865" # not CP850 ?? + echo "pt CP850" + echo "pt_BR CP850" + echo "pt_PT CP850" + echo "sv CP850" + echo "sv_SE CP850" + # ISO-8859-2 languages + echo "cs CP852" + echo "cs_CZ CP852" + echo "hr CP852" + echo "hr_HR CP852" + echo "hu CP852" + echo "hu_HU CP852" + echo "pl CP852" + echo "pl_PL CP852" + echo "ro CP852" + echo "ro_RO CP852" + echo "sk CP852" + echo "sk_SK CP852" + echo "sl CP852" + echo "sl_SI CP852" + echo "sq CP852" + echo "sq_AL CP852" + echo "sr CP852" # CP852 or CP866 or CP855 ?? + echo "sr_YU CP852" # CP852 or CP866 or CP855 ?? + # ISO-8859-3 languages + echo "mt CP850" + echo "mt_MT CP850" + # ISO-8859-5 languages + echo "be CP866" + echo "be_BE CP866" + echo "bg CP866" # not CP855 ?? + echo "bg_BG CP866" # not CP855 ?? + echo "mk CP866" # not CP855 ?? + echo "mk_MK CP866" # not CP855 ?? + echo "ru KOI8-R" # not CP866 ?? + echo "ru_RU KOI8-R" # not CP866 ?? + # ISO-8859-6 languages + echo "ar CP864" + echo "ar_AE CP864" + echo "ar_DZ CP864" + echo "ar_EG CP864" + echo "ar_IQ CP864" + echo "ar_IR CP864" + echo "ar_JO CP864" + echo "ar_KW CP864" + echo "ar_MA CP864" + echo "ar_OM CP864" + echo "ar_QA CP864" + echo "ar_SA CP864" + echo "ar_SY CP864" + # ISO-8859-7 languages + echo "el CP869" + echo "el_GR CP869" + # ISO-8859-8 languages + echo "he CP862" + echo "he_IL CP862" + # ISO-8859-9 languages + echo "tr CP857" + echo "tr_TR CP857" + # Japanese + echo "ja CP932" + echo "ja_JP CP932" + # Chinese + echo "zh_CN GBK" + echo "zh_TW CP950" # not CP938 ?? + # Korean + echo "kr CP949" # not CP934 ?? + echo "kr_KR CP949" # not CP934 ?? + # Thai + echo "th CP874" + echo "th_TH CP874" + # Other + echo "eo CP850" + echo "eo_EO CP850" + ;; esac diff --git a/lib/localcharset.c b/lib/localcharset.c index 12214b7..201483c 100644 --- a/lib/localcharset.c +++ b/lib/localcharset.c @@ -1,6 +1,6 @@ /* Determine a canonical name for the current locale's character encoding. - Copyright (C) 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 2000-2001 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published @@ -194,7 +194,7 @@ get_charset_aliases () into one of the canonical names listed in config.charset. The result must not be freed; it is statically allocated. If the canonical name cannot be determined, the result is a non-canonical - name or NULL. */ + name. */ #ifdef STATIC STATIC @@ -214,10 +214,14 @@ locale_charset () # else - /* On old systems which lack it, use setlocale and getenv. */ + /* On old systems which lack it, use setlocale or getenv. */ const char *locale = NULL; -# if HAVE_SETLOCALE + /* But most old systems don't have a complete set of locales. Some + (like SunOS 4 or DJGPP) have only the C locale. Therefore we don't + use setlocale here; it would return "C" when it doesn't support the + locale name the user has set. */ +# if HAVE_SETLOCALE && 0 locale = setlocale (LC_CTYPE, NULL); # endif if (locale == NULL || locale[0] == '\0') @@ -248,7 +252,10 @@ locale_charset () #endif - if (codeset != NULL && codeset[0] != '\0') + if (codeset == NULL) + /* The canonical name cannot be determined. */ + codeset = ""; + else if (codeset[0] != '\0') { /* Resolve alias. */ for (aliases = get_charset_aliases (); |