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

Re: printf %s in UTF-8 is not POSIX-compliant



I mixed up the field width and the precision, but there's the same
problem:

vin% emulate sh
vin% printf ".%.2s.\n" éabc      
.éa.
vin% /usr/bin/printf ".%.2s.\n" éabc
.é.
vin%

and POSIX says:

  field width
    An optional string of decimal digits to specify a minimum field
    width. For an output field, if the converted value has fewer
    bytes than the field width, [...]
    ^^^^^

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)



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