[Top][All Lists]

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

Re: UTF-8 printf string formating problem

From: Chet Ramey
Subject: Re: UTF-8 printf string formating problem
Date: Sun, 06 Apr 2014 18:58:31 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.3.0

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 behaviour when not in POSIX-compliance mode).
> IMHO my example demonstrates clearly, that printf output of UTF-8 chars is
> broken,
> (doesn't matter, if it is or not POSIX compliant).

Maybe.  Since bash uses whatever printf engine the system's libc provides,
and I don't have any interest in reimplementing fprintf(), we're subject
to printf(3)'s constraints.

> To solve this problem I suppose to add "wide" switch to printf
> or to add "%S" format   (similarly to wprintf(3) )

You might want to look at %ls to use instead of %S, though that doesn't
help you with your field width problem.

``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

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