Bug#782225: mksh: parameter expansion: string length ${#parameter} is incorrect on multibyte character
Package: mksh
Version: 50d-5
Severity: normal
In UTF-8 based locales:
$ mksh -c 'a=$(/usr/bin/printf \\u00e9); echo $a ${#a}'
é 2
while POSIX says[*]:
${#parameter}
String Length. The length in characters of the value of parameter
shall be substituted.
[*] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02
This the length in *characters*, not in bytes!
So, the output should be "é 1" like with bash, ksh93 and zsh.
-- System Information:
Debian Release: 8.0
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 3.16.0-4-amd64 (SMP w/8 CPU cores)
Locale: LANG=POSIX, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)
Versions of packages mksh depends on:
ii libc6 2.19-17
mksh recommends no packages.
Versions of packages mksh suggests:
ii ed 1.10-2
-- no debconf information
Reply to: