My main platform is Windows which is the reason why I use internally UTF-16 (mostly BMP strings). I would like to use console output for these strings.
Unfortunately there is no std::u16cout
or std::u8cout
so I need to use std::wcout
. Therefore I must convert my u16strings to wstrings - what is the best (and easiest) way to do that?
On Windows I know that wstring points to UTF16 data, so I can create a simple std::u16string_view which uses the same data (no conversion). But on Linux wstring is usually UTF32... Is there a way to do that without macros and without things like assuming sizeof(wchar_t) == 2 => utf16?
std::cout
andstd::string
, notstd::wcout
andstd::wstring
? That is, shouldn't the conversion be to UTF-8, which is ubiquitous on not-Windows platforms? – Evanesce