[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Please avoid using Xutf8* API.
From: |
宮下 尚:HIMI |
Subject: |
Re: Please avoid using Xutf8* API. |
Date: |
Sun, 28 Apr 2002 04:29:40 +0900 |
User-agent: |
T-gnus/6.15.4 (based on Oort Gnus v0.04) (revision 11) SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.3 Emacs/21.1 (i386-msvc-nt5.1.2600) MULE/5.0 (SAKAKI) Meadow/1.99 Alpha1 (AWOFUCHI) |
Sorry for the delay, I've contacted with one of the developpers
that had worked on I18N of X11R5.
"Stefan Monnier" <monnier+gnu/address@hidden> writes:
>> Xutf8* APIs was suddenly introduced into XFree86 abruptly without
>> concensus. After the developper noticed the change, there had been
>> tremendous discussions including flames to revoke these APIs.
>
> OK! I'll remove the change, then (it was somewhat experimental anyway).
> Note that it's conditionalized on X_HAVE_UTF8_STRING.
> Thanks for warning us about the problem.
Thank you very much. Emacs is a productive software that is used
by many people. So your mail relaxed me very well.
> The reason is basically as follows:
> let's say your locale is fr_CH.iso-8859-1 and you use xmodmap
> to bind some keycode to EuroSign. Clearly XmbLookupString can't
> return a string containing the euro char since it has
> to return an iso-8859-1 string (where the euro char doesn't exist).
> So we if XmbLookupString didn't return a string, we try again
> with Xutf8LookupString which gives us the euro char (in utf-8).
I understand. Of course, we should be able to deal with the case.
> Maybe an alternative would be to replace Xutf8LookupString with
>
> XmbLookupString(...)
> if (status_return == XLookupKeySym) {
> ;; Try again with unicode.
> <switch to utf-8 version of the same locale>
> XmbLookupString(...)
> <switch back to the original locale>
> }
>
> but my X (and locale) programming knowledge is about as good as
> inexistent so I have no idea how to do the switches.
Hmmm, this code does not work because XLC is determined by the current locale
when XOpenOM/IM() is called. So you have to call setlocale() when calling
XOpenIM() in xim_open_dpy()@xterm.c
char *orig, *modified;
orig = SetLocale(LC_CTYPE, NULL);
modified = get_utf_8_codeset_locale_name(orig);
setlocale(LC_CTYPE, modified);
xim = XOpenIM (dpyinfo->display, dpyinfo->xrdb, resource_name, EMACS_CLASS);
setlocale(LC_CTYPE, orig);
free(modified);
After doing it, you will be able to use UTF-8 string in XIM API by Xmb*
functions.
But this solution does not seem simple. The character repertorie of UTF-8
codeset
completely covers that of ISO-8859-1 and almost all of other codesets.
So when Emacs supports UTF-8 codeset without special modules like Mule-UCS ;-)
in the
near future, we have only to swith the codeset of the current locale ---
ISO-8859-1 or
something like --- to UTF-8 at the startup. Of course, even in this case,
Emacs dose
not need to change the default coding system to utf-8 at all.
With regards,
from himi