+ 15
Setting language locales using <locale>
I wish to change the locale settings of my terminal, so that it supports characters in Hindi. I am using Code::Blocks on Windows, and I have set the default encoding to UTF-8. So far, I tried the following : std::locale::global(std::locale("hi_IN.UTF-8")); std::locale::global(std::locale("hi_IN.UTF8")); std::locale::global(std::locale("Hindi")); But unfortunately, none of these worked for me. How can I set the locale effectively, and revert back the changes later?
13 ответов
+ 2
When last time my locals got changed it all got bugged up.
I was even unable to open terminal.
I don't remember perfectly but it will rise an perl error.
Sorry this comment is not helping but I'm trying to convince u not to change locals. :)
+ 2
YUGABDH PASHTE Thats sad to hear. I shall ask for a way to revert back the changes made later as well then, after I get a reply, that is.
+ 1
There is file named locals if your trying to make any changes. Make sure that they are made in that file too.
Also if u face any problem like me like failed to run terminal then there is xserver which will give you terminal if needed.
0
Ace Sorry I didn't mention, but I have tried setlocale as well. Still, I wasn't able to print the characters. All I see are a bunch of ? marks.
0
Ace In the terminal properties, all I see is the option to change the font.
From wchar.h, I just realized that there is something called wcout. Do I need to use that to print the characters? I was using the usual cout.
0
ye
0
Ace Sorry for the delay. I tried wcout, but there was no output, not even the empty boxes or ? marks. I tried searching on the net, and found that I need to ensure that the code page is UTF 8, which I did, but even then I could not generate the correct output.
Following are the code pages I have tried : 65001, 1200(UTF-16 LE), 1201 (UTF-16 BE), 1251(Default) and 57001(ISCII Devanagari Set for Hindi).
It may be that my actions are not affecting the terminal at all, but I cannot confirm the same.
0
Also, I am unable to understand as to why the changes are not reflected. Can this be a problem due to restricted permissions in Windows? I am not running the program as an administrator.