Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: sh emulation POSIX non-conformances (printf %10s and bytes vs character)
2021-04-11 18:57:26 +0100, Stephane Chazelas:
> Some non-POSIX conformances I can think of ATM:
[...]
Another POSIX bug fixed by zsh (but which makes it non-compliant):
With multibyte characters:
$ printf '|%10s|\n' Stéphane Chazelas
| Stéphane|
| Chazelas|
POSIX requires:
| Stéphane|
| Chazelas|
(with a UTF-8 é encoded one 2 bytes), that is, the width to be
a number of bytes not characters.
ksh93 has printf %20Ls where width is based on the display width
of characters.
$ zsh -c "printf '|%10Ls|\n' Ste$'\u0301'phane Chazelas"
| Stéphane|
| Chazelas|
$ ksh -c "printf '|%10Ls|\n' Ste$'\u0301'phane Chazelas"
| Stéphane|
| Chazelas|
(that one is not specified by POSIX)
--
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author