Displaying text in non-english language on console [modified]
-
Hi, I am trying to display non-english text on the std console. I have tried various methods like setconsole, _wsetconsole etc.. Defined _UNICODE and UNICODE macros also used wstring, wcout thinking that wide char variant might print the non-english text. Below is my sample program #include #include using namespace std; int_tmain() { wstring nonEnglishName = _TEXT("槧雲鼻"); wcout.imbue(locale("jpn"); wcout << _TEXT("Name in japanese is = ") << nonEnglishName.c_str() << endl; return 0; } The output I am getting is = Name in japanese is = ₧▀ë_ò@ My system locate is still set to US_ENGLSH and I do not want to change it. Can anybody please guide me regarding the correct procedure for displaying non-english text on the console? Thanks -- modified at 13:46 Wednesday 12th September, 2007
-
Hi, I am trying to display non-english text on the std console. I have tried various methods like setconsole, _wsetconsole etc.. Defined _UNICODE and UNICODE macros also used wstring, wcout thinking that wide char variant might print the non-english text. Below is my sample program #include #include using namespace std; int_tmain() { wstring nonEnglishName = _TEXT("槧雲鼻"); wcout.imbue(locale("jpn"); wcout << _TEXT("Name in japanese is = ") << nonEnglishName.c_str() << endl; return 0; } The output I am getting is = Name in japanese is = ₧▀ë_ò@ My system locate is still set to US_ENGLSH and I do not want to change it. Can anybody please guide me regarding the correct procedure for displaying non-english text on the console? Thanks -- modified at 13:46 Wednesday 12th September, 2007
Check out the
SetConsoleCP
andGetConsoleCP
API functions.Nothing is exactly what it seems but everything with seems can be unpicked.