samedi 25 février 2017

How can I use std::codecvt_utf8_utf16 to convert to and from utf8 without any string class?

How can I use std::codecvt_utf8_utf16 to convert from uft8 to utf16 and back without using any string class such as std::string or std::wstring but only plain arrays and literal strings? How can I know the right size of the buffer I need to store the conversion?

For example to meet this interface:

std::unique_ptr<char16_t[]> ToUTF16(const char* utf8String);
std::unique_ptr<char[]> ToUTF8(const char16_t* utf16String);

Aucun commentaire:

Enregistrer un commentaire