public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pcarlini at suse dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/16006] Conversions of numbers in fi_FI.UTF-8 produces incorrect UTF-8
Date: Wed, 16 Jun 2004 15:57:00 -0000	[thread overview]
Message-ID: <20040616155757.5443.qmail@sourceware.org> (raw)
In-Reply-To: <20040615164842.16006.olau@hardworking.dk>


------- 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


  parent reply	other threads:[~2004-06-16 15:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-15 16:48 [Bug libstdc++/16006] New: " olau at hardworking dot dk
2004-06-16  9:13 ` [Bug libstdc++/16006] " pcarlini at suse dot de
2004-06-16 14:18 ` olau at hardworking dot dk
2004-06-16 15:57 ` pcarlini at suse dot de [this message]
2004-06-16 16:08 ` pcarlini at suse dot de
     [not found] <bug-16006-6946@http.gcc.gnu.org/bugzilla/>
2006-10-07 19:48 ` pcarlini at suse dot de
2006-10-08 11:04 ` pcarlini at suse dot de
2006-11-06 11:24 ` bkoz at gcc dot gnu dot org
2010-01-08 18:48 ` paolo dot carlini at oracle dot com
     [not found] <bug-16006-4@http.gcc.gnu.org/bugzilla/>
2023-05-16 19:41 ` pinskia at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040616155757.5443.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).