This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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 libstdc++/15733] getline(wifstream, wstring) seems to be broken with UTF-8


------- Additional Comments From ahlgren at lysator dot liu dot se  2004-05-30 14:17 -------
(In reply to comment #10) 
> To be clear: the predefined streams 'wcin', 'wcout', etc, are synced with 
> stdio by default and for this reason *cannot* do any encoding/decoding. 
>  
> In order to obtain sensible results you either need to use always wfstreams 
> (in input and output) or call 'std::ios::sync_with_stdio(false);' before 
> doing any I/O. 
 
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? 
 
>  
> If wcin appear to work is only because is *not* doing any conversion. 
>  
> You need to imbue loc to the ifstream fin! 
>  
> Do things work in this case? 
 
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 :-( 
 
 

-- 


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


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