[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Please avoid using Xutf8* API.

From: Stefan Monnier
Subject: Re: Please avoid using Xutf8* API.
Date: Sun, 28 Apr 2002 19:25:00 -0400

> >     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.

Right, but since we currently do not support UTF-8 fully, we cannot
rely on it.  We have to use the "orig" locale and only revert to
UTF-8 when the orig locale failed.  Or maybe XmbLookupString
could do the defaulting for us and return a special indicator that
utf-8 was used instead of the locale-specified charset.

In any case, from what you say, there is currently no way for
Emacs to do the right thing, short of using the deprecated
Xutf8LookupString interface, so we'll just have to wait.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]