From 2301d127a2676303eac563e7932c03d9d72c446e Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 5 Jul 2013 22:00:57 +0200 Subject: unicode: check $LC_CTYPE too to detect Unicode mode Signed-off-by: Denys Vlasenko --- libbb/unicode.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'libbb/unicode.c') diff --git a/libbb/unicode.c b/libbb/unicode.c index c1e3966fe..35e88d307 100644 --- a/libbb/unicode.c +++ b/libbb/unicode.c @@ -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); } -- cgit v1.2.3