Bruno Haible wrote:

> This is nice theory. But the problem Bram is facing is:
>   - He would like to have vim run in an UTF-8 locale with a Japanese
>     input method.
>   - Most input methods for Japanese assume an EUC-JP encoding.
>   - The XIM functions in Xlib pass the text directly to the callbacks
>     the application has registered, without conversion. Look at imCallbk.c.
> 
> Thus some conversion from EUC-JP to UTF-8 must be done somewhere. Bram
> currently must do it in iconv. But I think doing it in Xlib would be
> better, because there are many applications like vim, and some of them
> don't want to use iconv - they just want to get UTF-8 input.

Right.  The information I gathered so far is that there is no UTF-8
locale available for X-windows.  At least not for most people on
existing systems.  Is it possible at all (under development)?

The XIM produces characters as "compound strings".  The application
receives it in the current locale, with an implicit conversion.  Since
an UTF-8 locale currently can't be used, I have to use the trick to keep
the locale set to euc-jp, for example, and translate it with iconv() to
UTF-8.

Vim then internally works with UTF-8 (this can be set with the
'charcode' option and selecting a Unicode font).  This is a bit tricky,
working with text in another encoding than the current locale, but I
think it will work.  Vim uses its own functions to deal with UTF-8, it
doesn't depend on mblen(), wcwidth(), etc.

A better solution would be that the locale is set to UTF-8.  The
X-windows functions should then automatically translate the compound
string to UTF-8.  Then no translation is necessary in the application.
This is for later.

Note that my conclusions have not been verified.

-- 
>From "know your smileys":
 |-P    Reaction to unusually ugly C code

 ///  Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.moolenaar.net  \\\
(((   Creator of Vim - http://www.vim.org -- ftp://ftp.vim.org/pub/vim   )))
 \\\  Help me helping AIDS orphans in Uganda - http://iccf-holland.org  ///
-
Linux-UTF8:   i18n of Linux on all levels
Archive:      http://mail.nl.linux.org/lists/

Reply via email to