Difference between revisions of "cpp/string/multibyte/mbstowcs"
From cppreference.com
(Fixed a mistake. It can't return -1, since it returns a size_t.) |
m (→Example: -= u8) |
||
Line 41: | Line 41: | ||
std::setlocale(LC_ALL, "en_US.utf8"); | std::setlocale(LC_ALL, "en_US.utf8"); | ||
std::wcout.imbue(std::locale("en_US.utf8")); | std::wcout.imbue(std::locale("en_US.utf8")); | ||
− | const char* mbstr = | + | const char* mbstr = "z\u00df\u6c34\U0001f34c"; // or u8"zß水🍌" |
// or "\x7a\xc3\x9f\xe6\xb0\xb4\xf0\x9f\x8d\x8c"; | // or "\x7a\xc3\x9f\xe6\xb0\xb4\xf0\x9f\x8d\x8c"; | ||
wchar_t wstr[5]; | wchar_t wstr[5]; |