From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: MIYASHITA Hisashi(=?ISO-2022-JP?B?GyRCNVwyPBsoQiAbJEI+MBsoQjpISU1J?=) Newsgroups: gmane.emacs.devel Subject: Re: Please avoid using Xutf8* API. Date: Sun, 28 Apr 2002 04:29:40 +0900 Sender: emacs-devel-admin@gnu.org Message-ID: References: <200204261741.g3QHfJj30681@rum.cs.yale.edu> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya") Content-Type: text/plain; charset=US-ASCII X-Trace: main.gmane.org 1019935832 8429 127.0.0.1 (27 Apr 2002 19:30:32 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sat, 27 Apr 2002 19:30:32 +0000 (UTC) Cc: emacs-devel@gnu.org, hiura@li18nux.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 171Xtw-0002Bq-00 for ; Sat, 27 Apr 2002 21:30:32 +0200 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 171XxC-0007W0-00 for ; Sat, 27 Apr 2002 21:33:55 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 171Xtk-0006np-00; Sat, 27 Apr 2002 15:30:20 -0400 Original-Received: from meadow.scphys.kyoto-u.ac.jp ([130.54.54.165]) by fencepost.gnu.org with smtp (Exim 3.34 #1 (Debian)) id 171Xt8-0006iy-00 for ; Sat, 27 Apr 2002 15:29:43 -0400 Original-Received: (qmail 20906 invoked from network); 27 Apr 2002 19:28:55 -0000 Original-Received: from meadow.scphys.kyoto-u.ac.jp (HELO MILCH.meadowy.org.meadowy.org) (root@130.54.54.165) by meadow.scphys.kyoto-u.ac.jp with SMTP; 27 Apr 2002 19:28:55 -0000 Original-To: "Stefan Monnier" In-Reply-To: <200204261741.g3QHfJj30681@rum.cs.yale.edu> (Stefan Monnier's message of "Fri, 26 Apr 2002 13:41:19 -0400") Original-Lines: 66 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) Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.9 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:3332 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:3332 Sorry for the delay, I've contacted with one of the developpers that had worked on I18N of X11R5. "Stefan Monnier" 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. > > XmbLookupString(...) > > } > > 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