Discussion:
[ast-developers] ksh: "read" doesn't skip multibyte input correctly
Daiki Ueno
2014-11-17 03:51:35 UTC
Permalink
Hello,

In some multibyte encodings, such as Shift_JIS[1], the trailing bytes of
a multibyte character may contain 7-bit character. That could confuse
the 'read' command on ksh.

$ /bin/echo -e '\x95\x5c' > x
$ LANG=ja_JP.SJIS ksh -c 'read a' < x
zsh: exit 1 LANG=ja_JP.SJIS ksh -c 'read a' < x

Note that the byte sequence '\x95\x5c' represents a multibyte character
U+8868, while '\x5c' is a backslash when interpreted as a single byte
character.

The attached patch tries to fix this.

Loading...