bug-coreutils
[Top][All Lists]
Advanced

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

Re: A bug -maybe or just some odd feature


From: James Youngman
Subject: Re: A bug -maybe or just some odd feature
Date: Wed, 2 May 2007 10:15:36 +0100

On 5/2/07, DR. Lee - NS1 <address@hidden> wrote:
5) The LANG=en and if I change LANG=zh_CH.GB2312, it does not make any
difference.

Characters that are displayed - at all - are displayed according to
the settings of your terminal emulator.  This is why the characters
appear correct with more, vi and so forth.

ls takes pains not to adversely affect terminals by sending data to
them which might upset them (because among other reasons, this can
cause security problems).  It does this by asking the C library which
characters are printable.  How does the C library know?

Well, here there is something of a problem; you have to tell the C
library yourself by setting environment variables.  Your terminator
does not automatically set up your shell's environment.  Your
environment variable settings _must_ match the setup of your terminal
emulator, otherwise you will get inconsistent behaviour.
Inconsistency between the behaviour of "ls" and "vi" for example.

To do this, set either LC_CTYPE (just to change chatacter type
handling) or LC_ALL (to change everything).  To verify that this has
worked OK, use "locale".    For example I live in Ireland and so I
use:

LANG=en_IE.UTF-8
LC_ALL=en_IE.UTF-8

You need to make sure that these environment varibles are exported by
your shell, otherwise other programs (including locale) will not pick
them up.   You will also need to ensure that these variables are set
correctly in either your login script or (as I do) in a system-wide
configuration file.  The system-wide configuration file used on my
system here (Debian GNU/Linux) is /etc/environment.

James.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]