Take this code snippet: #include <iostream> #include <io.h> #include <fcntl.h> int wmain(int argc, const wchar_t* argv[]) { _setmode(_fileno(stdout), _O_WTEXT); std::wcout << L"Thử nghiệm\n"; return 0; } On MS STL, this correctly outputs the string, but on libc++ it outputs nothing. Additional notes: Add -municode when compiling with clang, and add /utf-8 when compiling with MSVC
In contrast, the following equivalent C code works on both: #include <stdio.h> #include <io.h> #include <fcntl.h> int wmain(int argc, const wchar_t* argv[]) { _setmode(_fileno(stdout), _O_WTEXT); _putws(L"Thử nghiệm\n"); return 0; }