Re: The q parameter expansion flag does not support Unicode
Stephane Chazelas <[email protected]> Sun, 12 Jul 2026 13:59:46 +0100
| Newsgroups | gmane.comp.shells.zsh.devel |
|---|---|
| Message-ID | <[email protected]> |
On 2026-07-12 11:04, Vincent Lefevre wrote:
[...]
> var=$(printf "A\bB\u2060C")
> printf "%s\n" ${(q)var}
> printf "%s\n" $var:q
>
> the \b is quoted as $'\b', but the U+2060 WORD JOINER character
> is not quoted though it is not printable. I would have expected
> it to be quoted as $'\u2060'.
[[ $'\u2060' = [[:print:]] ]] returns true for me in the en_GB.UTF-8
locale of a Debian system (with glibc 2.42).
$'\u2029' is not considered as [[:print:]] and:
$ () { print -r - ${(q)1}; } $'\u2029'
$'\342\200\251'
I'd think notations like $'\u2029' should be avoided as they represent a
different sequence of bytes depending on locale.
--
Stephane