A
A
argumentvoid2020-11-10 09:24:16
visual studio
argumentvoid, 2020-11-10 09:24:16

Why doesn't the Russian language work in the console?

Every time when compiling a new project in Visual Studio 2019, this warning pops up (if it contains Russian characters)
5faa30cc1275e294044810.png
How can I fix this?
I tried saving the file with Windows encoding 1251 - didn't help. Russian characters are displayed incorrectly. Presumably, the problem is that he did not initially install the Russian language in the studio.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
res2001, 2020-11-10
@argumentvoid

Save the sources in cp866 encoding - this is the default encoding in the Windows console.
If you have a lab or some kind of test, then this will be enough.
But it's not really a solution to the problem. In the Windows console, the encoding can be changed in the console itself using the chcp command. Therefore, the normal way out of the situation would be:
1. Write sources in UTF8 and use wide characters to store strings.
2.Find out the console encoding 3.Before the
output, recode the text into the console encoding, only then display it
4.After entering the text, recode the entered text into UTF and then work with UTF.
You can also programmatically change the console encoding to the one in which you have the source code. But I do not recommend doing this in a working project.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question