kernel: fix determination of using locale

Sergei Butakov butsergej at
Tue Apr 18 01:52:34 CDT 2006

On Tuesday 18 April 2006 09:39, Dmitry Timoshkov wrote:
> "Sergei Butakov" <butsergej at> wrote:
> > If set
> > # export LANG="POSIX"
> > # export LC_CTYPE="ru_RU.CP1251"
> > system_lcid (defined by LC_CTYPE) will be "ru_RU.CP1251";
> > user_lcid (defined by LANG) will be "en_US" - It's bug and it's visible
> > in programs for Windows.
> That's correct IMO, LANG takes the precedence over LC_TYPE. If you specify
> LANG="POSIX" you get what you asked for. AFAIK glibc does the same thing.


From `man locale` (glibc-2.3.4):

	Provide a DEFAULT value for the internationalization variables that are UNSET 
or NULL.
	IF SET to a non-empty string value, OVERRIDE the values of all the OTHER 
internationalization variables.
	Determine the locale for the interpretation of sequences of bytes of text 
data as  characters.

So any program must check variables in that order: LC_ALL, LC_CTYPE, LANG.
(First check LC_ALL. If LC_ALL defined then stop, if not defined then check 
LC_CTYPE. If LC_CTYPE defined then stop, if not defined then check LANG)

In Wine system_lcid defined by LC_ALL, LC_CTYPE, LANG. It's right.
user_lcid defined by LC_ALL, LANG only. It's wrong. LC_CTYPE must be checked 

More information about the wine-devel mailing list