From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Stefan Monnier" Newsgroups: gmane.emacs.devel Subject: Re: Please avoid using Xutf8* API. Date: Sun, 28 Apr 2002 19:25:00 -0400 Sender: emacs-devel-admin@gnu.org Message-ID: <200204282325.g3SNP0a13474@rum.cs.yale.edu> References: <200204261741.g3QHfJj30681@rum.cs.yale.edu> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1020036469 20667 127.0.0.1 (28 Apr 2002 23:27:49 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 28 Apr 2002 23:27:49 +0000 (UTC) Cc: "Stefan Monnier" , 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 171y57-0005NC-00 for ; Mon, 29 Apr 2002 01:27:49 +0200 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 171y8b-0004Qf-00 for ; Mon, 29 Apr 2002 01:31:25 +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 171y4d-0003d4-00; Sun, 28 Apr 2002 19:27:19 -0400 Original-Received: from rum.cs.yale.edu ([128.36.229.169]) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 171y2g-0003XQ-00 for ; Sun, 28 Apr 2002 19:25:18 -0400 Original-Received: (from monnier@localhost) by rum.cs.yale.edu (8.11.6/8.11.6) id g3SNP0a13474; Sun, 28 Apr 2002 19:25:00 -0400 X-Mailer: exmh version 2.4 06/23/2000 with nmh-1.0.4 Original-To: MIYASHITA Hisashi (=?ISO-2022-JP?B?GyRCNVwyPBsoQiAbJEI+MBsoQjpISU1J?=) 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:3363 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:3363 > > 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. 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. Stefan