[Bug libstdc++/35353] C++ wide character locale doesn't work
ivranos at freemail dot gr
gcc-bugzilla@gcc.gnu.org
Mon Feb 25 12:13:00 GMT 2008
------- Comment #8 from ivranos at freemail dot gr 2008-02-25 12:12 -------
Summary of the case:
What doesn't work:
#include <iostream>
#include <locale>
#include <string>
int main()
{
using namespace std;
wcin.imbue(locale("greek"));
wcout.imbue(locale("greek"));
wstring ws;
wcin>> ws;
wcout<< ws<< endl;
}
What works (under 2 conditions):
1. Only when "locale::global()" statement is used:
#include <iostream>
#include <locale>
#include <string>
int main()
{
using namespace std;
locale::global(locale("en_US"));
wcin.imbue(locale("greek"));
wcout.imbue(locale("greek"));
wstring ws;
wcin>> ws;
wcout<< ws<< endl;
}
2. Only when "ios_base::sync_with_stdio(false)" statement is used.
#include <iostream>
#include <locale>
#include <string>
int main()
{
using namespace std;
ios_base::sync_with_stdio(false);
wcin.imbue(locale("greek"));
wcout.imbue(locale("greek"));
wstring ws;
wcin>> ws;
wcout<< ws<< endl;
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35353
More information about the Gcc-bugs
mailing list