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

Re: The q parameter expansion flag does not support Unicode



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




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