Modified UTF16BEUTF8 to just convert the UTF-16 C-string into a std::u16string, and pass it into CodeToUTF8 with the 'from' parameter being "UTF-16BE", rather than manually performing the big endian to little endian encoding.
This commit is contained in:
parent
ba111959fa
commit
a949e98d9b
|
@ -570,9 +570,7 @@ std::string UTF16ToUTF8(const std::wstring& input)
|
|||
std::string UTF16BEToUTF8(const char16_t* str, size_t max_size)
|
||||
{
|
||||
const char16_t* str_end = std::find(str, str + max_size, '\0');
|
||||
std::u16string result(static_cast<size_t>(str_end - str), '\0');
|
||||
std::transform(str, str_end, result.begin(), static_cast<u16 (&)(u16)>(Common::swap16));
|
||||
return CodeToUTF8("UTF-16LE", result);
|
||||
return CodeToUTF8("UTF-16BE", std::u16string(str, static_cast<size_t>(str_end - str)));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue