D
D
Dmitry2017-06-01 12:49:08
C++ / C#
Dmitry, 2017-06-01 12:49:08

How to display Cyrillic in a C program?

Good afternoon. When you try to display the Cyrillic alphabet, hieroglyphs appear. Tried to use Setlocale, but nothing changes. I use MinGW, Windows 10.
b35c5e1aa3994393b497a0cb194da316.PNG

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
res2001, 2017-06-01
@dmttch

When writing a console program for Windows, you need to consider:
1. In what encoding in the text of the program are your Russian lines.
2. Console encoding may vary. By default, the encoding in the Windows console is 866, you can switch to 1251.
3. The console API and stdlib of the C language do not automatically recode anything.
4. The compiler does not recode anything, it does not care what you have in quotes.
5.If you output without recoding, then you can get a normal result only if the console encoding matches the encoding of your Russian characters in the source code.
In order not to depend on the console encoding, you can:
1. do not display Russian letters
2. Get confused with transcoding to console encoding before output. It's pretty easy, just half a day of reading MSDN and tests.

K
kpa6uu, 2017-06-01
@kpa6uu

SetConsoleOutputCP

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question