[Bug libstdc++/15733] getline(wifstream, wstring) seems to be broken with UTF-8
pcarlini at suse dot de
gcc-bugzilla@gcc.gnu.org
Mon May 31 16:20:00 GMT 2004
------- Additional Comments From pcarlini at suse dot de 2004-05-30 14:26 -------
> Oh, does that explain why I need 'setenv(LC_ALL, "")' to make the output work
> with wcin/wcout? Removing that line will cripple the output with wcin/wcout.
> On the other hand, removing the imbue calls doesn't affect anything, but this
> should be fixed by calling sync_with_stdio(false), did I get it right?
Basically, yes.
>Yes things work fine adding 'fin.imbue(loc);'
>Thanks. The reason for not trying this is that the only call that actually sets
>the proper locale is 'setlocale(LC_ALL, "")' so far, but that was apparently as
>misunderstanding :-(
Yes. You can think of 'setlocale(LC_ALL, "")' as the 'C', not the 'C++' way
to deal with localization. In C++, every different converting stream (i.e.,
fstream, basically or the predefined but only if un-synced, which leads to
fstream under the hood anyway) has its own locale used for doing conversions:
you may have thousands of those, each one different, at the same time. You
select each locale via 'imbue'.
Notice that my explanation above is simplified and rough. In order to know
the details I suggest a good book, such as Langer & Kreft.
Thanks.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15733
More information about the Gcc-bugs
mailing list