Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

read -d $'\200' doesn't work with set +o multibyte



Even in a locale with a single-byte charmap, when multibyte is
off, I can't make read -d work when the delimiter is a byte >=
0x80.

$ LC_ALL=en_GB.iso885915 ./Src/zsh +o multibyte
$ locale charmap
ISO-8859-15
$ locale ctype-mb-cur-max
1
$ print 'a\351b' | read -rd $'\351'
$ print $?
1
$ print -r -- $REPLY | LC_ALL=C od -tc
0000000   a 351   b  \n
0000004

Without set +o multibyte, the above works (at treating 0351 (é
in that charset) as a delimiter), but not for \200 (undefined in
ISO-8859-1 which I guess is expected).

With LC_ALL=C, on GNU systems where mbrtowc() returns -1 EILSEQ
for any byte >= 0x80, I find read -d doesn't work for byte >=
0x80 used as delimiter with or without set +o multibyte.

(on Debian GNU/Linux amd64 with 5.9 or git HEAD).

I've raised a related issue against ksh93
(https://github.com/ksh93/ksh/issues/590)

It looks like POSIX are considering specifying  read -d. They
would leave it unspecified if the delimiter is neither the empty
string nor a single-byte character.
https://austingroupbugs.net/view.php?id=243#c6091

-- 
Stephane








Messages sorted by: Reverse Date, Date, Thread, Author