Hello,

On Mon, 28 Jan 2002, Pablo Saratxaga wrote:

> BTW, I don't know if it's related or not, but xcin seems to don't follow
> locale aliases defined by X11.
> eg: it requires the locale to be "zh_TW.Big5", but if the locale used
> internally by X11 is "zh_TW.big5" and you have in locales.alias:

This is definitely related. I believe it's the reason for this problem.
However it's not that xcin doesn't follow X11's naming convention. The
difference is actually what they do with the name. Xcin simply take whatever
user set and report it. While X11 always normalizes the name to an internal one
and use this "canonic" name exclusively thereafter regardless what user input
was. In this particular case, X11 would normalize everything to "zh_TW.big5".
However most people use "zh_TW.Big5" when setting their locales and that is
what xcin reports. When trying to connect to an input server, X11 will try to
find one that reports locale name matching its internal one exactly. Of cause
it won't be able to find in this case, thus fails even xcin is active. Should
one uses "zh_TW.big5" to setup locale, everything would be fine.

> zh_TW.Big5:   zh_TW.big5
> 
> you should expect it to work; but it doesn't.
> 
> Now I remember that I had to edit the locales.alias and locales.dir in order
> to have "zh_TW.Big5" as the "canonic" locale name used by X11 (that is,
> have in locales.dir:
> 
> zh_TW.big5/XLC_LOCALE:  zh_TW.Big5

That'll work. Actually it used to be there in locales.dir in 4.1 and
that's why that version had no problem.  There are other locales that are
in similar situation. However keep tracking all the possibilities and
stacking them into locales.dir is kind of messy, imho. In the last few
XFree86 releases there always problems in this area. So I propose an
alternative solution which is simpler. Instead of doing a case-sensitive
comparison as it does right now, we should do a case-insensitive one when
comparing locale names in xim's initialization code. This only requires
one line change. It shouldn't cause any problem because we probably could
safely assume that if two names differ only in case, they are for same
locale. Especially this is only in xim code and only involves a subset of
locales. I have attached a patch to this effect below. If no one objects,
I'll submit it to [EMAIL PROTECTED] (Note: This patch also handles a
special case, i.e. X11 uses the name "zh_CN.eucCN" for the commonly used
locale name "zh_CN.GB2312". This is much worse than case difference, so
the later has to be added into locales.dir. Fortunately this is the only
exception).

Regards,
rigel



--- xc/lib/X11/xlibi18n/im/ximcp/imDefIm.c.orig Mon Jan 28 02:25:44 2002
+++ xc/lib/X11/xlibi18n/im/ximcp/imDefIm.c      Mon Jan 28 02:27:05 2002
@@ -165,7 +165,7 @@
        *p = '\0';
 
        for( n = 0; n < len; n++ )
-           if( locale_name[n] && !strcmp( pp, locale_name[n] ) )
+           if( locale_name[n] && !strcasecmp( pp, locale_name[n] ) )
                return locale_name[n];
        if (finish)
            break;
--- xc/nls/locale.dir.orig      Tue Jan 29 01:02:36 2002
+++ xc/nls/locale.dir   Tue Jan 29 01:04:00 2002
@@ -213,6 +213,7 @@
 iso8859-15/XLC_LOCALE:                 wa_BE.ISO8859-15
 microsoft-cp1255/XLC_LOCALE:           yi_US.CP1255
 zh_CN/XLC_LOCALE:                      zh_CN.eucCN
+zh_CN/XLC_LOCALE:                      zh_CN.GB2312
 zh_CN.gbk/XLC_LOCALE:                  zh_CN.gbk
 zh_HK.big5/XLC_LOCALE:                 zh_HK.big5
 zh_HK.big5hkscs/XLC_LOCALE:            zh_HK.big5hkscs
--- xc/nls/locale.alias.orig    Tue Jan 29 01:04:06 2002
+++ xc/nls/locale.alias Tue Jan 29 01:06:43 2002
@@ -636,14 +636,13 @@
 yi_US.microsoft-cp1255:                                yi_US.CP1255
 yi_US.MICROSOFT-CP1255:                                yi_US.CP1255
 zh:                                            zh_CN.eucCN
-zh_CN:                                         zh_CN.eucCN
+zh_CN:                                         zh_CN.GB2312
 zh_CN.Big5:                                    zh_TW.big5
 zh_CN.EUC:                                     zh_CN.eucCN
-zh_CN.GB2312:                                  zh_CN.eucCN
 zh_CN.GBK:                                     zh_CN.gbk
 zh_CN.big5:                                    zh_TW.big5
 zh_CN.euc:                                     zh_CN.eucCN
-zh_CN.gb2312:                                  zh_CN.eucCN
+zh_CN.gb2312:                                  zh_CN.GB2312
 zh_HK:                                         zh_HK.big5
 zh_HK.Big5:                                    zh_HK.big5
 zh_HK.Big5HKSCS:                               zh_HK.big5hkscs

_______________________________________________
I18n mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/i18n

Reply via email to