emacs-devel
[Top][All Lists]
Advanced

[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: Fri, 26 Apr 2002 13:41:19 -0400

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

> I couldn't find the discussions that corresponds to this change
> in emacs-devel ML, but from ChangeLog, this change seems to be
> introduced on 4/16.  Could you please teach us why do you need
> this change, Mr.Monnier?

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

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.

Also we'd need to be sure that doing the locale-switches and the
additional call to XmbLookupString doesn't mess up any internal state.
This seemed to work with Xutf8LookupString, although we couldn't
find any doc that guarantees it.


        Stefan




reply via email to

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