[Bug libstdc++/16006] Conversions of numbers in fi_FI.UTF-8 produces incorrect UTF-8

pcarlini at suse dot de gcc-bugzilla@gcc.gnu.org
Wed Jun 16 15:57:00 GMT 2004


------- Additional Comments From pcarlini at suse dot de  2004-06-16 15:57 -------
> This flag is a GNU extension.

So, we are in the realm of -extensions-, not of Standard C. Ok, if you want to
use that, but, beware, no consistency with the C++ Standard is guaranteed.

> You are wrong -
> the output is _not_ OK. It is not UTF-8. Run the program with .ISO-8859-1
> instead of .UTF-8, and you get the non-breaking space in .ISO-8859-1. Then
> put that character through iconv from ISO-8859-1 to UTF-8 and you get _two_
> characters, not one (in fact it could not possible be just one character when
> it's UTF-8).

In the ISO Standard the thousands separator is a -single- char_type of the
-internal- encoding. Therefore, in general, in order to accomplish what you
want, you have to use an internal encoding sufficiently wide (cout -> wcout)
and also you have to call std::ios::sync_with_stdio(false) before any other
I/O operation, otherwise no encoding to UTF-8 (from the internal
representation) will take place (despite the imbue).

Thanks, Paolo.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16006



More information about the Gcc-bugs mailing list