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

Re: Trying to fix slang



Hi,

At Wed, 30 Jan 2002 22:48:48 +0900,
Junichi Uekawa wrote:
> 
> Phil Blundell <pb@nexus.co.uk> cum veritate scripsit:
> 
> > I'm not suggesting that the character set should be somehow encoded into
> > the value of $TERM.  Rather, I think that an xterm in UTF-8 mode and an
> > xterm in iso-8859-1 or whatever mode are simply different types of
> > terminal, and they should have different names. 

UTF-8 is not a special encoding, but one encoding out of many encodings
which is (should be) supported by Debian.  Thus, I don't like an idea
of having special $TERM only for UTF-8 mode.

In future, xterm will be sensible to LANG variable (strictly speaking,
LC_CTYPE locale) using "luit" which is included in XFree86 4.2.  Thus,
if you invoke xterm in ISO-8859-2 locale, xterm will be ISO-8859-2.
if you invoke xterm in KOI8-R locale, xterm will be KOI8-R.
if you invoke xterm in EUC-JP locale, xterm will be EUC-JP.
if you invoke xterm in UTF-8 locale, xterm will be UTF-8.
(You will agree that it is a bad idea that xterm will have dozens
of values of $TERM according to the encoding.)

So far, inconsistency between LANG variable and terminal encoding
is a problem.  However, relying on LANG variable (strictly speaking,
LC_CTYPE locale by using setlocale(3) or nl_langinfo(3)) is the only
way for application softwares to determine encoding for stream I/O.
It is users' responsibility to have sane LANG variable which matches
with the encoding of terminal emulator so far.


> Note that language-env package seems to craft up a 
> .bashrc which sets the LC_ALL and LANG variable
> according to the terminal type.
> 
> LC_ALL=ja_JP.eucJP 
> will only be set when terminal is kterm etc., and 
> LC_ALL=C
> 
> I don't know if it checks for UTF-8 capabilities and sets it,
> and I don't know if it is actually the ideal way to go forward.
> Tomohiro, comments ?

This is a makeshift way until all terminals (terminal emulators
and consoles) will be able to check LC_CTYPE locale and change
encoding mode.  The ideal is that terminal emulators will obey
LANG variable.


In conclusion, application softwares must check LC_CTYPE locale
(by calling nl_langinfo(3) after setlocale(3)) to determine
encoding.

---
Tomohiro KUBOTA <kubota@debian.org>
http://www.debian.or.jp/~kubota/
"Introduction to I18N"  http://www.debian.org/doc/manuals/intro-i18n/



Reply to: