This is the mail archive of the
cygwin-developers
mailing list for the Cygwin project.
Re: bash and the current locale implementation
setenv (locale_var);
if (locale_var == "LANG" || "LC_ALL")
setlocale (LC_ALL, "");
else if (locale_var == "LC_CTYPE")
setlocale (LC_CTYPE, "");
Irrespective of the discussion whether or when some such invocations
should be applied,
I am a little bit confused about this code itself.
Does it suggest that LANG would take precedence over LC_CTYPE? That
would be wrong.
The precedence of variables to be used to determine a locale category's
value is as follows:
1. LC_ALL if it is defined and not empty (overriding everything)
2. specific LC_ variable (LC_CTYPE in the case of checking the encoding)
if defined and not empty
3. LANG as a last resort if both of the above are undefined or empty
Or, putting it in bash syntax:
${LC_ALL:-${LC_CTYPE:-$LANG}}