In UTF-8 based locales:
$ dash -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.
Same problem with: dash -c 'case é in ?) echo OK;; esac' which doesn't print OK in UTF-8 locales.
It looks like this problem will not be addressed upstream: the dash maintainer says [1] that «dash doesn't handle locales at all» and somebody else in the same thread states that «many of [the UTF-8 related variations in behaviour between shells] are about "unspecified behaviour"». [1] http://thread.gmane.org/gmane.comp.shells.dash/1136/focus=1139 Regards,