summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--shell/ash.c2
-rw-r--r--shell/ash_test/ash-vars/var-utf8-length.right1
-rwxr-xr-xshell/ash_test/ash-vars/var-utf8-length.tests2
3 files changed, 5 insertions, 0 deletions
diff --git a/shell/ash.c b/shell/ash.c
index b5a2d96..5613e1f 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)
if (subtype == VSLENGTH && len > 0) {
reinit_unicode_for_ash();
if (unicode_status == UNICODE_ON) {
+ STADJUST(-len, expdest);
+ discard = 0;
len = unicode_strlen(p);
}
}
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 0000000..6f4247a
--- /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 0000000..d04b2cb
--- /dev/null
+++ b/shell/ash_test/ash-vars/var-utf8-length.tests
@@ -0,0 +1,2 @@
+X=abcdÉfghÍjklmnÓpqrstÚvwcyz
+echo ${#X}