aboutsummaryrefslogtreecommitdiff
path: root/libbb/unicode.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2013-07-05 22:00:57 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2013-07-05 22:00:57 +0200
commit2301d127a2676303eac563e7932c03d9d72c446e (patch)
tree9bb912bd5df0a5b5676837e26625672a61f41ad8 /libbb/unicode.c
parent4f9fc1e5f5897dd2d143fa837f9288d55cf57f51 (diff)
downloadbusybox-2301d127a2676303eac563e7932c03d9d72c446e.tar.gz
unicode: check $LC_CTYPE too to detect Unicode mode
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb/unicode.c')
-rw-r--r--libbb/unicode.c8
1 files changed, 8 insertions, 0 deletions
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);
}