[PATCH] Small change to correctly query the systems charset

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

 



VDR User wrote:
>> This patch just changes charset querying to not only look at environment
>> variable LANG, but respect all in correct order. So now I can overwrite
>> charset setting with LC_CTYPE and LC_ALL.
> 
> Just curious, why would you need to query anything other than the
> environment LANG variable?  If that tells you what the user wants to
> use, there's no need to look any further.  Unless it's empty I guess?

 From man 7 locale:
> If the second argument to setlocale() is  empty  string,  "",  for  the
> default locale, it is determined using the following steps:
> 
> 1.     If there is a non-null environment variable LC_ALL, the value of
>        LC_ALL is used.
> 2.     If an environment variable with the same name as one of the cat-
>        egories above exists and is non-null, its value is used for that
>        category.
> 3.     If there is a non-null environment variable LANG, the  value  of
>        LANG is used.

In other words, the locale system can be set in environment by three 
different ways, by setting LANG (lowest precedence), by setting specific 
language aspects (LC_CTYPE describes just character sets, not sorting, 
numeric notation, date notation etc), or by setting LC_ALL (highest 
precedence).

Even if LANG is set, it may not be valid, because other settings can 
override it. And not on all systems LANG is used to set the locale.

Cheers,

Udo



[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux