Update 2022 12 13
This is me thinking. Windows is UTF16 OS; why try to make it UTF8 OS? Just leave it alone and let it be wide-char OS.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
// this is WIN10 2022 Q4 #include <stdio.h> #include <io.h> #include <fcntl.h> #define specimen L"кошка 日本" void test_crash_console_output( void ) { // 2022-12-13 latest is: Visual Studio 2022 version 17.3.4 printf("n_MSC_FULL_VER: %dn", _MSC_FULL_VER); fflush(stdout); _setmode(_fileno(stdout), _O_U16TEXT); // use here printf(); and you will het what you // asked for, use wprinth and wide char // and all just works (dont forget the appropriate font) wprintf(L"%s", specimen); // back to the ANSI fflush(stdout); _setmode(_fileno(stdout), _O_TEXT); } int main (void){ test_crash_console_output(); return 42; } |
And all is dandy in the winland of sugar and candy …
Update 2018 12 07
The key problem, as explained here, is now acknowledged by Visual Studio / MSVC team. Please follow here.
Update 2018 12 05
Many thanks to many of you visiting this post every day. As a “reward”, I have made the small console app to help you set up your Windows console to show UTF-8 text properly.

This little program is, of course, free and you can download it (zipped) from here, straight away. Continue reading