unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Stefan Monnier" <monnier+gnu/emacs@RUM.cs.yale.edu>
Cc: "Stefan Monnier" <monnier+gnu/emacs@RUM.cs.yale.edu>,
	emacs-devel@gnu.org, hiura@li18nux.org
Subject: Re: Please avoid using Xutf8* API.
Date: Sun, 28 Apr 2002 19:25:00 -0400	[thread overview]
Message-ID: <200204282325.g3SNP0a13474@rum.cs.yale.edu> (raw)
In-Reply-To: un0vphrdn.fsf@MILCH.meadowy.org

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


	Stefan

  reply	other threads:[~2002-04-28 23:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-26 16:46 Please avoid using Xutf8* API MIYASHITA Hisashi
2002-04-26 17:41 ` Stefan Monnier
2002-04-27 19:29   ` MIYASHITA Hisashi
2002-04-28 23:25     ` Stefan Monnier [this message]
2002-04-28 23:54       ` Hideki Hiura

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200204282325.g3SNP0a13474@rum.cs.yale.edu \
    --to=monnier+gnu/emacs@rum.cs.yale.edu \
    --cc=emacs-devel@gnu.org \
    --cc=hiura@li18nux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).