From a949e98d9b3b77493a0e38e7f2227e57c8c6e066 Mon Sep 17 00:00:00 2001 From: 34will Date: Thu, 11 Jan 2018 16:55:23 +0000 Subject: [PATCH] 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. --- Source/Core/Common/StringUtil.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Source/Core/Common/StringUtil.cpp b/Source/Core/Common/StringUtil.cpp index 83384479ee..e2a7b7cfb7 100644 --- a/Source/Core/Common/StringUtil.cpp +++ b/Source/Core/Common/StringUtil.cpp @@ -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(str_end - str), '\0'); - std::transform(str, str_end, result.begin(), static_cast(Common::swap16)); - return CodeToUTF8("UTF-16LE", result); + return CodeToUTF8("UTF-16BE", std::u16string(str, static_cast(str_end - str))); } #endif