#782224 dash doesn't support multibyte characters in string handling

Package:
dash
Source:
dash
Description:
POSIX-compliant shell
Submitter:
Vincent Lefevre
Date:
2015-12-04 08:51:05 UTC
Severity:
normal
#782224#5
Date:
2015-04-09 11:36:29 UTC
From:
To:
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.

#782224#10
Date:
2015-04-09 12:45:35 UTC
From:
To:
Same problem with:

  dash -c 'case é in ?) echo OK;; esac'

which doesn't print OK in UTF-8 locales.

#782224#17
Date:
2015-12-04 08:48:02 UTC
From:
To:
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,