Re: The q parameter expansion flag does not support Unicode

Stephane Chazelas <[email protected]> Sun, 12 Jul 2026 19:55:55 +0100
Newsgroups gmane.comp.shells.zsh.devel
Message-ID <[email protected]>
On 2026-07-12 17:35, Vincent Lefevre wrote:
[...]
> then [Tab] just after "$var", I get
> 
>   printf "%s\n" A$'\b'B<2060>C
> 
> with <2060> in reverse video.

That would be because U+2060 has zero width.

Same for my first name with the é in decomposed form (e followed by 
combining acute accent):

$ var=$'Ste\u301phane'
$ print -r - ${(q)var}
Stéphane
$ echo Ste<0301>phane # after TAB
$ echo ${(m)#var[4]}
0

Having Ste$'\314'$'\201'phane here would make it a lot less readable.

Unicode is full of zero width characters that have an impact on the 
rendering of text in a variety of ways, zsh has to choose some mechanism 
to decide what to quote with the various q operators, iswprint() sounds 
like a reasonable compromise to me.

For ZLE making zero-width ones visible helps for editing them around.

-- 
Stephane