Question:
Set encoding to utf-8:
SetConsoleCP(CP_UTF8);
SetConsoleOutputCP(CP_UTF8);
I output the text in the stream:
cout << "Введите первое число: a = ";
And the console gives me this:
��ведите первое число: a =
I tried to search for information on the tyrnet, unfortunately I did not find anything, perhaps I was looking for it wrong. Please help me solve the problem.
Answer:
This is because the low-level WinApi functions for outputting strings to the console in UTF-8 expect a completed string. Functions like puts will output your string correctly. And here is the output through basic_ostream<char>::operator<<(char*)
probably for a string
"Введите первое число: a = "
first calls winapi with the first byte of the double-byte character В
, then with the second and the rest of the string, which is displayed as:
��ведите первое число: a =