Simple but annoying problem

Hello,

Could someone explain me how to fix this problem :


When I use my wxDevCpp IDE to make console program wich will for example do this :

 
cout << " Hello, Č,Š,Ć,Ž " << endl;



The graphemes "Č,Š,Ć,Ž" will display unproperly (some weird letters).


But when I make my program take input from user like this

1
2
3
4
cout << "Put some graphemes" << endl;
cin >> grapheme

cout << grapheme << endl;


Then graphemes in console display properly.

So, in end:

When I use " cout " then graphemes like "Š,Č,Ć,Ž,Đ " etc. don't display properly, but when I type them in console as "user" and then "cout" them then they display properly.

I heard this can be fixed by using CharToOem() and OemToChar() but I don't know how.

Any easy solutions to my problems?

Thanks!
Last edited on
Apparently its not that easy, there's another post on the topic, but I don't think they found a complete solution http://cplusplus.com/forum/windows/9797/
How do you ' type them in console as "user" ' just out of curiosity?
I think he means he runs the program, and types them into the console. When the text comes in through cin, then prints back to cout it prints properly.
I think he means he runs the program, and types them into the console. When the text comes in through cin, then prints back to cout it prints properly.


Yes, that's right.

And I did manage to solve my problem using AnsiToOem, but I wonder if there is any automated way to incorporate it to IDE or something so I don't need to do it for every sentence.

Thanks.

EDIT : I found another way of doing it using

setlocale (LC_ALL, "");

So here it is if anyone needs it :)

Thanks.
Last edited on
Topic archived. No new replies allowed.