GNU bug report logs -
#17196
multibyte: printf: %s counts bytes instead of characters
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
On 04/07/2014 06:11 PM, Pádraig Brady wrote:
>
> If we had to make it explicit for backwards compat reasons,
> then I suppose counting by characters is the least useful,
> so we could just standardize the existing ksh behavior and have:
>
> printf '%3s' 'blah' # count bytes
> printf '%3Ls' 'blah' # count cells
> LANG=C '%3Ls' 'blah' # count bytes
If we add %3Ls to the shell, we should also add it to libc's printf(3),
which means coordinating with the C committee.
>
> This has the disadvantage of not degrading gracefully
> on dash for example where %Ls is rejected.
If a future version of the standard mandates behavior for %Ls, I suspect
dash would be made compliant fairly quickly - the dash maintainers
strive hard to comply with POSIX.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[signature.asc (application/pgp-signature, attachment)]
This bug report was last modified 6 years and 250 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.