c++ – Cyrillic input / output in Windows console


He worked on Linux , there were no problems with encodings at all. Now it was necessary to work on Windows .

Everything seems to be good, but there were no Russian symbols, only krakozyabry. Changed to others when:

setlocale(LC_ALL, "Russian");

I dug in the registry, changed the console font, in general, everything that is adequate in Google . Then I decided to accidentally change SetConsoleCP(1251); on SetConsoleCP(CP_UTF8); (of course also SetConsoleOutputCP(CP_UTF8); ).

There was a lot of joy, the native language in the console. But a couple of days have passed and now it is necessary to enter more Russian, but the program immediately lays down. Judging by the debugger, the line is just empty.

How can you fix this?


Check the encoding of the compiled * .cpp files, they must be in the encoding in which you output the text.

Scroll to Top