diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2013-07-02 17:30:23 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2013-07-02 17:30:23 +0200 |
commit | 3e7ecb179b193bf17323c975890eed1d025f7e4c (patch) | |
tree | 99b869b4f6fa759aacb2c8e12464797c9e930a3d | |
parent | ea267d518ff55517e174b9e8514fc521e4a3b41e (diff) | |
download | busybox-w32-3e7ecb179b193bf17323c975890eed1d025f7e4c.tar.gz busybox-w32-3e7ecb179b193bf17323c975890eed1d025f7e4c.tar.bz2 busybox-w32-3e7ecb179b193bf17323c975890eed1d025f7e4c.zip |
unicode: check $LC_ALL to detect Unicode mode, not only $LANG
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | libbb/unicode.c | 14 | ||||
-rw-r--r-- | shell/ash.c | 6 | ||||
-rw-r--r-- | shell/hush.c | 4 |
3 files changed, 18 insertions, 6 deletions
diff --git a/libbb/unicode.c b/libbb/unicode.c index 99dc1dfa6..c1e3966fe 100644 --- a/libbb/unicode.c +++ b/libbb/unicode.c | |||
@@ -39,8 +39,11 @@ void FAST_FUNC reinit_unicode(const char *LANG) | |||
39 | 39 | ||
40 | void FAST_FUNC init_unicode(void) | 40 | void FAST_FUNC init_unicode(void) |
41 | { | 41 | { |
42 | if (unicode_status == UNICODE_UNKNOWN) | 42 | if (unicode_status == UNICODE_UNKNOWN) { |
43 | reinit_unicode(getenv("LANG")); | 43 | char *s = getenv("LC_ALL"); |
44 | if (!s) s = getenv("LANG"); | ||
45 | reinit_unicode(s); | ||
46 | } | ||
44 | } | 47 | } |
45 | 48 | ||
46 | #else | 49 | #else |
@@ -58,8 +61,11 @@ void FAST_FUNC reinit_unicode(const char *LANG) | |||
58 | 61 | ||
59 | void FAST_FUNC init_unicode(void) | 62 | void FAST_FUNC init_unicode(void) |
60 | { | 63 | { |
61 | if (unicode_status == UNICODE_UNKNOWN) | 64 | if (unicode_status == UNICODE_UNKNOWN) { |
62 | reinit_unicode(getenv("LANG")); | 65 | char *s = getenv("LC_ALL"); |
66 | if (!s) s = getenv("LANG"); | ||
67 | reinit_unicode(s); | ||
68 | } | ||
63 | } | 69 | } |
64 | # endif | 70 | # endif |
65 | 71 | ||
diff --git a/shell/ash.c b/shell/ash.c index 6af14f551..90f222467 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -9657,7 +9657,11 @@ preadfd(void) | |||
9657 | * _during_ shell execution, not only if it was set when | 9657 | * _during_ shell execution, not only if it was set when |
9658 | * shell was started. Therefore, re-check LANG every time: | 9658 | * shell was started. Therefore, re-check LANG every time: |
9659 | */ | 9659 | */ |
9660 | reinit_unicode(lookupvar("LANG")); | 9660 | { |
9661 | const char *s = lookupvar("LC_ALL"); | ||
9662 | if (!s) s = lookupvar("LANG"); | ||
9663 | reinit_unicode(s); | ||
9664 | } | ||
9661 | nr = read_line_input(line_input_state, cmdedit_prompt, buf, IBUFSIZ, timeout); | 9665 | nr = read_line_input(line_input_state, cmdedit_prompt, buf, IBUFSIZ, timeout); |
9662 | if (nr == 0) { | 9666 | if (nr == 0) { |
9663 | /* Ctrl+C pressed */ | 9667 | /* Ctrl+C pressed */ |
diff --git a/shell/hush.c b/shell/hush.c index 1a2603e3b..1fa84dc4f 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -2044,7 +2044,9 @@ static void get_user_input(struct in_str *i) | |||
2044 | * _during_ shell execution, not only if it was set when | 2044 | * _during_ shell execution, not only if it was set when |
2045 | * shell was started. Therefore, re-check LANG every time: | 2045 | * shell was started. Therefore, re-check LANG every time: |
2046 | */ | 2046 | */ |
2047 | reinit_unicode(get_local_var_value("LANG")); | 2047 | const char *s = get_local_var_value("LC_ALL"); |
2048 | if (!s) s = get_local_var_value("LANG"); | ||
2049 | reinit_unicode(s); | ||
2048 | 2050 | ||
2049 | G.flag_SIGINT = 0; | 2051 | G.flag_SIGINT = 0; |
2050 | /* buglet: SIGINT will not make new prompt to appear _at once_, | 2052 | /* buglet: SIGINT will not make new prompt to appear _at once_, |