aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2013-07-02 17:30:23 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2013-07-02 17:30:23 +0200
commit3e7ecb179b193bf17323c975890eed1d025f7e4c (patch)
tree99b869b4f6fa759aacb2c8e12464797c9e930a3d
parentea267d518ff55517e174b9e8514fc521e4a3b41e (diff)
downloadbusybox-3e7ecb179b193bf17323c975890eed1d025f7e4c.tar.gz
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.c14
-rw-r--r--shell/ash.c6
-rw-r--r--shell/hush.c4
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)
void FAST_FUNC init_unicode(void)
{
- if (unicode_status == UNICODE_UNKNOWN)
- reinit_unicode(getenv("LANG"));
+ if (unicode_status == UNICODE_UNKNOWN) {
+ char *s = getenv("LC_ALL");
+ if (!s) s = getenv("LANG");
+ reinit_unicode(s);
+ }
}
#else
@@ -58,8 +61,11 @@ void FAST_FUNC reinit_unicode(const char *LANG)
void FAST_FUNC init_unicode(void)
{
- if (unicode_status == UNICODE_UNKNOWN)
- reinit_unicode(getenv("LANG"));
+ if (unicode_status == UNICODE_UNKNOWN) {
+ char *s = getenv("LC_ALL");
+ if (!s) s = getenv("LANG");
+ reinit_unicode(s);
+ }
}
# endif
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)
* _during_ shell execution, not only if it was set when
* shell was started. Therefore, re-check LANG every time:
*/
- reinit_unicode(lookupvar("LANG"));
+ {
+ const char *s = lookupvar("LC_ALL");
+ if (!s) s = lookupvar("LANG");
+ reinit_unicode(s);
+ }
nr = read_line_input(line_input_state, cmdedit_prompt, buf, IBUFSIZ, timeout);
if (nr == 0) {
/* 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)
* _during_ shell execution, not only if it was set when
* shell was started. Therefore, re-check LANG every time:
*/
- reinit_unicode(get_local_var_value("LANG"));
+ const char *s = get_local_var_value("LC_ALL");
+ if (!s) s = get_local_var_value("LANG");
+ reinit_unicode(s);
G.flag_SIGINT = 0;
/* buglet: SIGINT will not make new prompt to appear _at once_,