Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I can't see the russian alphabet in Visual Studio 2008

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:

???????? ??? ????
like image 639
Maria Avatar asked Oct 07 '22 01:10

Maria


1 Answers

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.

like image 158
gdbcore Avatar answered Oct 21 '22 11:10

gdbcore