From: Oliver Kiddle <opk@zsh.org>
To: "Jun. T" <takimoto-j@kba.biglobe.ne.jp>
Cc: zsh-workers@zsh.org
Subject: Re: read -d $'\200' doesn't work with set +o multibyte (and [PATCH])
Date: Fri, 16 Dec 2022 09:29:44 +0100 [thread overview]
Message-ID: <18686-1671179384.136789@8qJu.Y1PF.BJgr> (raw)
In-Reply-To: <C63F0FA2-1730-40DB-9C12-28FECE3EC406@kba.biglobe.ne.jp>
"Jun. T" wrote:
> > --- a/Test/B04read.ztst
> > +++ b/Test/B04read.ztst
> (snip)
> > + read -ed $'\xc2'
> > +0:read delimited by a single byte terminates if the byte is part of a multibyte character
> > +<one£two
> > +>one
>
> Is this really what the standard requires (or will require)?
> Breaking in the middle of a valid multibyte character looks
> rather odd to me.
The proposed standard wording appears to only talk about the case of the
delimiter consisting of "one single-byte character". $'\xc2' is not a
valid UTF-8 character so my interpretation is that they are leaving this
undefined.
Behaviour that treats the input as raw bytes for a raw byte delimiter
is consistent. This retains compatibility with the way things
work for a non-multibyte locale. Not all files are valid UTF-8 and it
can be useful to force things to work at a raw byte level.
The only alternative I can think of would be to print an error for the
delimiter. Did you have something else in mind?
Oliver
next prev parent reply other threads:[~2022-12-16 8:30 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-09 15:42 read -d $'\200' doesn't work with set +o multibyte Stephane Chazelas
2022-12-09 20:05 ` Oliver Kiddle
2022-12-10 9:06 ` read -d $'\200' doesn't work with set +o multibyte (and [PATCH]) Stephane Chazelas
2022-12-13 11:12 ` Jun T
2022-12-14 21:42 ` Oliver Kiddle
2022-12-15 12:37 ` Jun. T
2022-12-16 8:29 ` Oliver Kiddle [this message]
2022-12-18 10:51 ` Jun. T
2022-12-18 17:58 ` Stephane Chazelas
2022-12-15 2:01 ` Oliver Kiddle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=18686-1671179384.136789@8qJu.Y1PF.BJgr \
--to=opk@zsh.org \
--cc=takimoto-j@kba.biglobe.ne.jp \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).