Le Monday 12 September 2005 à 04:07, Masahito Omote a écrit:
> Hello,
> 
> On Sun, 11 Sep 2005 20:15:55 +0200
> Alban Crequy <[EMAIL PROTECTED]> wrote:
> 
> > all_locales() returned NULL. I don't know why. The patch add this:
> > >    if (name == NULL) name = "";
> > so compose_localenames_from_im_lang() does not return NULL anymore.
> 
> Please try without @euro suffix in LC_CTYPE and LANG. For example set 
> LC_CTYPE=fr_FR.ISO8859-15
> , LC_CTYPE=fr_FR.UTF-8, and so on. For more details see locale_map[] global 
> variables in
> locale.cpp.

Whatever I set, it does not work (I tried fr, fr_FR, fr_FR.ISO8859-1,
fr_FR.ISO8859-15, fr_FR.UTF-8, fr_BE.UTF-8, en_US, en_US.ISO8859-1,
en_US.UTF-8, en_US:UTF-8).

I added some debug printf:
----->8--------->8----------->8-----
--- xim/locale.cpp.ORIG 2005-09-11 22:41:35.000000000 +0200
+++ xim/locale.cpp      2005-09-11 22:43:46.000000000 +0200
@@ -297,6 +297,7 @@ get_valid_locales(const char *locales)
     // locales is separated with ':'
     while ((locale = strsep(&tmpp, ":")) != NULL) {
        if (setlocale(LC_CTYPE, locale) != NULL) {
+           printf("DEBUG setlocale(%s) OK\n", locale);
            asprintf(&validated, "%s:", locale);
            len += strlen(validated);
            if (valid_locales) {
@@ -309,6 +310,7 @@ get_valid_locales(const char *locales)
        } else {
            // retry with supplemental encodings
            int i;
+           printf("DEBUG setlocale(%s) FAILURE\n", locale);
            for (i = 0; locale_map[i].localename; i++) {
                if (is_locale_included(locale_map[i].localename, locale))
                    break;
----->8--------->8----------->8-----

The result is that setlocale() always failed. Not a single "OK":
DEBUG setlocale(af_ZA) FAILURE
DEBUG setlocale(am_ET) FAILURE
DEBUG setlocale(ar_AA) FAILURE
DEBUG setlocale(ar_BH) FAILURE
DEBUG setlocale(ar_DZ) FAILURE
[...]
DEBUG setlocale(fr_FR) FAILURE
DEBUG setlocale(fr_BE) FAILURE
DEBUG setlocale(fr_CA) FAILURE
DEBUG setlocale(fr_CH) FAILURE
DEBUG setlocale(fr_LU) FAILURE
[...]
DEBUG setlocale(zh_HK) FAILURE


I read "man setlocale" which says:

« For a list  of  all  supported locales, try "locale -a", cf. locale(1). »

So I tried:

$ locale -a
C
[EMAIL PROTECTED]
[EMAIL PROTECTED]
POSIX

The problem is that none of the 4 locales I have on my computer is in
the locale_map global variable.

In order to be sure that this is the problem, I tested the following
patch:

----->8--------->8----------->8-----
--- xim/locale.cpp.ORIG 2005-09-11 22:41:35.000000000 +0200
+++ xim/locale.cpp      2005-09-11 22:49:49.000000000 +0200
@@ -93,7 +93,7 @@ static struct {
     {"fa", "fa_IR", "UTF-8:ISIRI-3342"},
     {"fi", "fi_FI", "ISO8859-15:ISO8859-1:UTF-8"},
     {"fo", "fo_FO", "ISO8859-1:ISO8859-15:UTF-8"},
-    {"fr", "fr_FR:fr_BE:fr_CA:fr_CH:fr_LU", "ISO8859-1:ISO8859-15:UTF-8"},
+    {"fr", "fr_FR:[EMAIL PROTECTED]:fr_BE:fr_CA:fr_CH:fr_LU", 
"ISO8859-1:ISO8859-15:UTF-8"},
     {"ga", "ga_IE", "ISO8859-1:ISO8859-14:ISO8859-15"},
     {"gd", "gd_GB", "ISO8859-1:ISO8859-14:ISO8859-15"},
     {"gl", "gl_ES", "ISO8859-1:ISO8859-15:UTF-8"},
----->8--------->8----------->8-----

And it works: I get my debug printf:
DEBUG setlocale(fr_FR) FAILURE
DEBUG setlocale([EMAIL PROTECTED]) OK

And I don't have Segmentation fault anymore.

Should "[EMAIL PROTECTED]" be included somewhere like this? Or "C" or "POSIX"
must be included somewhere in the locale_map global variable? I am not
familiar with locales; I don't know what should be done.

Note that "[EMAIL PROTECTED]" exists in /usr/share/i18n/SUPPORTED and it is
distinct from "fr_FR".

$ grep fr_FR /usr/share/i18n/SUPPORTED
fr_FR.UTF-8 UTF-8
[EMAIL PROTECTED] UTF-8
fr_FR ISO-8859-1
[EMAIL PROTECTED] ISO-8859-15


Thanks,

Alban


Reply via email to