I'm trying to output Russian words in Visual Studio 2008. I wrote:
#include <iostream>
#include <locale.h>
using namespace std;
void main()
{
setlocale(LC_ALL,"rus");
cout << "Я хочу видеть это по-русски!";
}
When I pressed Ctrl+S to save the file in Visual Studio, I received the following prompt:
Some Unicode characters in this file could not be saved in the current codepage. Would you like to save it in unicode?
I chose the option "Save with other Encoding" and selected "Cyrillic (Windows) - Codepage 1251." However, when I run my program, the console output appears as follows:
???????? ??? ????
The problem is that you aren't using Unicode characters set (wstring, wcout as @
Bình Nguyên have already mentioned). There are two ways to solve this problem:
1. Use unicode characters set.
2. Go to Control Panel -> Region and Language -> Administrative Tab -> Language for non-Unicode programs -> Change system locale... -> choose Russia.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With