Even in today’s mostly-Unicode world on Windows, the console (i.e. cmd.exe) still defaults to using OEM code pages (i.e. multibyte characters). To set the console to Unicode mode, use the following code:
1 2 3 4 5 6 7 8 9 10 |
#include <fcntl.h> #include <io.h> #include <stdio.h> int main(void) { _setmode(_fileno(stdout), _O_U16TEXT); wprintf(L"\x043a\x043e\x0448\x043a\x0430 \x65e5\x672c\x56fd\n"); return 0; } |
This information came from two great articles by Michael Kaplan: Conventional wisdom is retarded, aka What the @#%&* is _O_U16TEXT? Anyone who …