Gentoo Archives: gentoo-dev

From: Stanislav Brabec <utx@g.o>
To: gabor <gabor@××××.net>
Cc: gentoo-dev@g.o
Subject: Re: [gentoo-dev] better handling of multibyte characters (nls/cjk/unicode)
Date: Thu, 06 Nov 2003 22:58:16
Message-Id: 1068159266.8089.18.camel@utx.utx.cz
1 gabor wrote:
2
3 > could you explain to me what's the difference between LC_ALL and LANG?
4 >
5 > until now i'm using export LC_ALL=en_US.UTF-8 in /etc/profile...
6 > should i change it to LANG=en_US.UTF-8?
7
8 If you don't use other LC_{category}, there is no difference.
9
10 But if you use it with these variables, there it is:
11
12 LANG is fallback, overridden by all other LC_* variables.
13
14 LC_ALL is enforcement, and overrides LANG and all LC_{category}
15 variables. It means: if you define LC_ALL, sessing LC_{category} has no
16 effect.
17
18 There is an example:
19
20 utx$ ( export LANG=C LC_NUMERIC=C LC_ALL=C ; printf "%'5.3f\\n" 1 )
21 1.000
22 utx$ ( export LANG=C LC_NUMERIC=C LC_ALL=cs_CZ ; printf "%'5.3f\\n" 1 )
23 1,000
24 utx$ ( export LANG=cs_CZ LC_NUMERIC=C LC_ALL=C ; printf "%'5.3f\\n" 1 )
25 1.000
26 utx$ ( export LANG=C LC_NUMERIC=cs_CZ LC_ALL=C ; printf "%'5.3f\\n" 1 )
27 1.000
28 utx$ ( export LANG=C LC_NUMERIC=cs_CZ ; printf "%'5.3f\\n" 1 )
29 1,000
30
31 Note: Script programmers do often a mistake, using following
32 construction:
33 LC_TIME=C date
34
35 It works incorrectly, if you have LC_ALL set to any language.
36
37 --
38 Stanislav Brabec
39 http://www.penguin.cz/~utx, ICQ 116020046
40
41 --
42 gentoo-dev@g.o mailing list