unicode: check $LC_CTYPE too to detect Unicode mode

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2013-07-05 22:00:57 +02:00
parent 4f9fc1e5f5
commit 2301d127a2
4 changed files with 13 additions and 2 deletions

View file

@ -39,8 +39,15 @@ void FAST_FUNC reinit_unicode(const char *LANG)
void FAST_FUNC init_unicode(void)
{
/* Some people set only $LC_CTYPE, not $LC_ALL, because they want
* only Unicode to be activated on their system, not the whole
* shebang of wrong decimal points, strange date formats and so on.
*
* TODO? Maybe we should use LC_CTYPE instead of LC_ALL in setlocale()?
*/
if (unicode_status == UNICODE_UNKNOWN) {
char *s = getenv("LC_ALL");
if (!s) s = getenv("LC_CTYPE");
if (!s) s = getenv("LANG");
reinit_unicode(s);
}
@ -63,6 +70,7 @@ void FAST_FUNC init_unicode(void)
{
if (unicode_status == UNICODE_UNKNOWN) {
char *s = getenv("LC_ALL");
if (!s) s = getenv("LC_CTYPE");
if (!s) s = getenv("LANG");
reinit_unicode(s);
}