Re: UTF-8 printf string formating problem

2014-04-07 Thread Pádraig Brady
On 04/06/2014 12:56 PM, Dan Douglas wrote: > On Sunday, April 06, 2014 01:24:58 PM Jan Novak wrote: >> To solve this problem I suppose to add "wide" switch to printf >> or to add "%S" format (similarly to wprintf(3) ) > > ksh93 already has this feature using the "L" modifier: > > ksh -c "printf

Re: UTF-8 printf string formating problem

2014-04-06 Thread Chet Ramey
On 4/6/14, 7:24 AM, Jan Novak wrote: > Chris Down wrote: >> I don't have much of an opinion on whether this behaviour is right or >> wrong in the context of bash, but if this behaviour is changed, I think >> it should be done under another format character, rather than changing >> %s (or changing b

Re: UTF-8 printf string formating problem

2014-04-06 Thread Dan Douglas
On Sunday, April 06, 2014 01:24:58 PM Jan Novak wrote: > To solve this problem I suppose to add "wide" switch to printf > or to add "%S" format (similarly to wprintf(3) ) ksh93 already has this feature using the "L" modifier: ksh -c "printf '%.3Ls\n' $'\u2605\u2605\u2605\u2605\u2605'" ★★★ bash

Re: UTF-8 printf string formating problem

2014-04-06 Thread Jan Novak
Chris Down wrote: I don't have much of an opinion on whether this behaviour is right or wrong in the context of bash, but if this behaviour is changed, I think it should be done under another format character, rather than changing %s (or changing behaviour when not in POSIX-compliance mode). IM

Re: UTF-8 printf string formating problem

2014-04-05 Thread Andreas Schwab
Jan Novak writes: > IMHO this is a big bug, because it breaks any non ASCII chars formating. It is consistent with printf(3). Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different.

Re: UTF-8 printf string formating problem

2014-04-05 Thread Chris Down
Jan Novak writes: > printf string format counts bytes instead of chars, which leads to > broken output According to POSIX, printf's field width control is strictly in bytes, not characters.[0] > field width: > An optional string of decimal digits to specify a minimum field > width. For a

UTF-8 printf string formating problem

2014-04-05 Thread Jan Novak
Hello, printf string format counts bytes instead of chars, which leads to broken output ... just try this: (/usr/bin/printf is broken too) $ echo $LANG us_US.UTF-8 $ printf "|%4s|\n" "aa" | aa| $ printf "|%4s|\n" "áá" (chars are a-acute) |áá| expected output: | áá| IMHO this is a big b