samedi 24 août 2019

Difference between "codecvt_utf8_utf16" and "codecvt_utf8" for converting from UTF-8 to UTF-16

I came across two code snippets

std::wstring str = std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>>().from_bytes("some utf8 string");

and,

std::wstring str = std::wstring_convert<std::codecvt_utf8<wchar_t>>().from_bytes("some utf8 string");

Are they both correct ways to convert utf-8 stored in std::string to utf-16 in std::wstring?

Aucun commentaire:

Enregistrer un commentaire