std locale and setLocale problem
Hello. I have some problem to write in console localized text.
It's my test:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
int main()
{
//Variant 1:
setlocale(LC_ALL, "");
std::cout << setlocale(LC_ALL, NULL) << std::endl; //return "C"
//Variant 2:
try {
std::locale::globale(std::locale(""));
} catch (std::exeption &e)
{
std::cout << e.what() << std::endl; // msg: "Bad locale"
}
//Variant 3:
TCHAR wlocale[255]; //Unicode
GetSystemDefaultLocaleName(wlocale, 255); // return "ru_Ru"
_tsetlocale(LC_ALL, wlocale);
std::cout << setlocale(LC_ALL, NULL) << std::endl; // return "C";
//Varinat 4:
//the same for std::locale()
//I wont to write to console:
std::cout << "Привет мир!" << std::endl; //russian Hello world or another language
return 0;
}
|
thanks
Last edited on
TCHAR [255]; //Unicode
This variable has no name, are you aware of that?
Last edited on
sry its just bad copy past
Topic archived. No new replies allowed.