[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#341686: xterm cannot be started in utf-8 mode by default



On Sat, Dec 03, 2005 at 01:19:24PM +0100, Jan Willem Stumpel wrote:
> Thomas Dickey wrote:
> 
> >I already responded to this in
> >
> >	http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=318923
> 
> Yes.. but I did not understand it and I also had the impression
> that in that thread, two different bugs were being discussed.

yes - but I still thought I had addressed it.  The cited report was a different
issue (we fell into a hole in Xft).  However, your problem is simpler to
analyze (provided that I didn't overlook some interaction in the resources).

The changelog entry that I pointed out modified xterm to ignore part of the
environment to allow one to control xterm's behavior a little better, but it
did not remove functionality.
 
> >also see the manpage:
> >
> > -u8  This  option  sets  the utf8 resource.  When utf8 is set, xterm
> >      interprets incoming data as UTF-8.   This  sets  the  wideChars
> >      resource  as  a  side-effect,  but  the  UTF-8 mode set by this
> >      option prevents it from being turned off.  If you must turn  it
> >      on and off, use the wideChars resource.
> 
> I am sorry, but this is very unclear to a non-expert like me.
> 
> >                 
> >      This option and the utf8 resource are overridden by the -lc and
> >      -en options and locale resource.  
> 
> If I call from the command line
> 
>     xterm -lc
> or
>     xterm -lc [somelocale]
> 
> it says (version 204):
> 
> xterm:  bad command line option "-lc"

The -lc option does not accept a parameter.  Granted, xterm has many options,
but there is a simple(r) way to see the syntax.  The output of "xterm -h"
shows a synopsis, e.g.,

    -/+l                         turn on/off logging
    -/+lc                        turn on/off locale mode using luit
    -lcc path                    filename of locale converter (/usr/X11R6/bin/l>

(with surrounding lines for context).  What that would say in a longer
list is
 
    -lc                        turn on locale mode using luit
    +lc                        turn off locale mode using luit

That only turns things on and off.  Now that I'm looking at it, I notice the
manpage does not mention that xterm recognizes "on" as a synonym for the
locale resource's "true" and "off" for its "false" value.  The latter are
documented in the manpage, e.g.,

       locale (class Locale)
               Specifies how to use luit, an encoding converter between  UTF-8
               and  locale  encodings.  The resource value (ignoring case) may
               be:
...
               false
                   xterm will use conventional 8bit mode or UTF-8 mode accord-
                   ing to utf8 resource or -u8 option.

So the next question is how to use this information.  From the commandline,
I could type

	xterm -xrm '*locale:false' -u8

but of course that gets tedious.  I generally have my $HOME/bin before other
directories in $PATH, so it would be simple to write a shell script that
wraps xterm, something like this (named "xterm"):

	#!/bin/sh
	/usr/bin/X11/xterm -xrm '*locale:false' -u8 "$@"

That has the drawback (addressed by uxterm) of allowing someone with a
non-UTF-8 locale to invoke xterm, making it do I/O in UTF-8 encoding.
So I don't think that's what you want (though it was what Thomas Wolff
requested).

Supposing that your locale is set to a UTF-8 one such as de_DE.UTF-8,
then

	xterm -xrm '*locale:true' -u8

will start xterm in UTF-8 mode (and due to the lack of parameter of the
-u8 option, that cannot be turned off).  I just did a quick check of that,
and it seems to work properly.  In your .Xdefaults, you could do

	XTerm*VT100.locale:true
	XTerm*VT100.utf8:2

to accomplish the same thing (I just tried this with en_US.UTF-8, and it
seems to do the right thing).  If your locale had no "UTF-8" in the name,
xterm would stay in 8-bit mode.

-- 
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net

Attachment: pgpmb30rDBSmW.pgp
Description: PGP signature


Reply to: