Unexpected output std :: wcout << L "élève"; in windows shell

When testing some functions for converting strings between wchar_t and utf8, I met the following weird result with Visual C ++ express 2008

std::wcout << L"élève" << std::endl;

displays "ÚlÞve:", which is clearly not what is expected.

This is obviously a mistake. How can it be? How do I expect to deal with such a "feature"?

+3
source share
5 answers

The C ++ compiler does not support Unicode in code files. Instead, you should replace these characters with your escaped versions.

Try the following:

std::wcout << L"\x00E9l\x00E8ve" << std::endl;

In addition, your console must also support Unicode.

UPDATE:

, Unicode.

+12

. , ( , MSVC).

+1

, , . ?

UTF-8, Windows : "OEM" ( ) "ANSI" ( ).

++ ANSI 1252 (, , 1254, 1256 1258), OEM- 850.

+1

IDE, ANSI. OEM.

, .

0

Source: https://habr.com/ru/post/1705967/


All Articles