diff options
-rw-r--r-- | shell/ash.c | 2 | ||||
-rw-r--r-- | shell/ash_test/ash-vars/var-utf8-length.right | 1 | ||||
-rwxr-xr-x | shell/ash_test/ash-vars/var-utf8-length.tests | 2 |
3 files changed, 5 insertions, 0 deletions
diff --git a/shell/ash.c b/shell/ash.c index b5a2d961d..5613e1f33 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -6692,6 +6692,8 @@ varvalue(char *name, int varflags, int flags, struct strlist *var_str_list) | |||
6692 | if (subtype == VSLENGTH && len > 0) { | 6692 | if (subtype == VSLENGTH && len > 0) { |
6693 | reinit_unicode_for_ash(); | 6693 | reinit_unicode_for_ash(); |
6694 | if (unicode_status == UNICODE_ON) { | 6694 | if (unicode_status == UNICODE_ON) { |
6695 | STADJUST(-len, expdest); | ||
6696 | discard = 0; | ||
6695 | len = unicode_strlen(p); | 6697 | len = unicode_strlen(p); |
6696 | } | 6698 | } |
6697 | } | 6699 | } |
diff --git a/shell/ash_test/ash-vars/var-utf8-length.right b/shell/ash_test/ash-vars/var-utf8-length.right new file mode 100644 index 000000000..6f4247a62 --- /dev/null +++ b/shell/ash_test/ash-vars/var-utf8-length.right | |||
@@ -0,0 +1 @@ | |||
26 | |||
diff --git a/shell/ash_test/ash-vars/var-utf8-length.tests b/shell/ash_test/ash-vars/var-utf8-length.tests new file mode 100755 index 000000000..d04b2cbb6 --- /dev/null +++ b/shell/ash_test/ash-vars/var-utf8-length.tests | |||
@@ -0,0 +1,2 @@ | |||
1 | X=abcdÉfghÍjklmnÓpqrstÚvwcyz | ||
2 | echo ${#X} | ||