This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/13140] no-break space as thousands_sep causes inconsistent output
- From: "bugdal at aerifal dot cx" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Thu, 10 Oct 2013 16:45:42 +0000
- Subject: [Bug libc/13140] no-break space as thousands_sep causes inconsistent output
- Auto-submitted: auto-generated
- References: <bug-13140-131 at http dot sourceware dot org/bugzilla/>
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.