From: Martijn Dekker <martijn@inlv.org>
To: zsh-workers@zsh.org
Subject: Re: In POSIX mode, ${#var} measures length in bytes, not characters
Date: Sun, 07 Jun 2015 04:21:45 +0200 [thread overview]
Message-ID: <5573AAB9.5090709@inlv.org> (raw)
In-Reply-To: <6697841433637291@web4o.yandex.ru>
ZyX schreef op 07-06-15 om 02:34:
> Do you have a reference where “character” is defined?
Yes:
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap06.html#tag_06_02
POSIX specifically allows any character encoding, including multibyte
characters, depending on the user's locale, and on the condition that
the portable character set (basically US-ASCII) is a subset of the
locale's character set.
With UTF-8 now the de facto standard locale and it including multibyte
characters, it's become important for shells to get this right.
> This behaviour is the same in posh and dash:
Yes, dash and pdksh/mksh/posh unfortunately have this bug, too.
But bash, ksh93, and yash correctly measure characters, not bytes. (yash
is supposed to be the most POSIX-compliant of them all.)
Thanks,
- Martijn
next prev parent reply other threads:[~2015-06-07 2:27 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-07 0:23 Martijn Dekker
2015-06-07 0:34 ` ZyX
2015-06-07 1:23 ` Bart Schaefer
2015-06-07 1:27 ` ZyX
2015-06-07 2:21 ` Martijn Dekker [this message]
2015-06-09 17:49 ` Martijn Dekker
2015-06-08 8:44 ` Peter Stephenson
2015-06-09 2:19 ` Martijn Dekker
2015-06-09 8:35 ` Peter Stephenson
2015-06-09 15:37 ` Bart Schaefer
2015-06-09 15:43 ` Peter Stephenson
2015-06-11 11:23 ` Daniel Shahaf
2015-06-11 11:33 ` Peter Stephenson
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=5573AAB9.5090709@inlv.org \
--to=martijn@inlv.org \
--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).