Can Windows' std::wcout display UTF-16 wchar_t surrogate pairs as a unicode character?

244 Views Asked by At

[LIVE]

\U0001F34C\U0002008A on cout  : 
\U0001F34C\U0002008A on wcout : 
                      wcsnlen : 4
1 :     0xd83c
2 :     0xdf4c
3 :     0xd840
4 :     0xdc8a
    wcsrtombs to char on cout : 

Even though UCRT makes MSVC more compliant with the standard.

Each character above BMP on Windows is stored as a UTF-16 surrogate pairs. It looks like standard std::wcout on Windows is implemented in the way it can't display any of these characters.

Other than convert back from wchar_t to multibyte char (UTF-8), can we make Windows std::wcout display these kind of characters right away?

0

There are 0 best solutions below