bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: UTF-8 printf string formating problem


From: Dan Douglas
Subject: Re: UTF-8 printf string formating problem
Date: Sun, 06 Apr 2014 06:56:43 -0500
User-agent: KMail/4.12.4 (Linux/3.14.0-pf1+; KDE/4.12.4; x86_64; ; )

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 -c "printf '%.3Ls\n' $'\u2605\u2605\u2605\u2605\u2605'"
★

Also, zsh does this by default with no special option. I tend to lean towards 
going by character anyway because that's what most shell features such as "read 
-N" do, and most work directly involving the shell is with text not binary data.
-- 
Dan Douglas



reply via email to

[Prev in Thread] Current Thread [Next in Thread]