This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/13140] no-break space as thousands_sep causes inconsistent output


https://sourceware.org/bugzilla/show_bug.cgi?id=13140

Rich Felker <bugdal at aerifal dot cx> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugdal at aerifal dot cx

--- Comment #3 from Rich Felker <bugdal at aerifal dot cx> ---
The "legwork" needed is on the part of the application, not glibc. glibc is
doing exactly the right thing here; non-wide printf-family functions' field
widths are all in terms of bytes, not characters. Even if there were not a
standard (ISO C) dictating the current behavior, there is no flexibility to
change this, because for some uses of sprintf may rely on width being in bytes
to avoid buffer overflow.

If you want field widths in characters, you have to use the wide printf-family
functions. This is problematic of course because stdio streams have an
orientation (byte or wide) and you cannot mix byte and wide functions on them.
So, for practical purposes, you probably have to use swprintf or
open_wmemstream and fwprintf, then print the resulting string using fprintf
with the %ls specifier.

Simply avoiding thousands separators at the printf level is probably an easier
solution.

In any case, I don't think there's anything glibc can do to make this easier.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]