summaryrefslogtreecommitdiff
path: root/Source/Core/Common/StringUtil.cpp
diff options
context:
space:
mode:
author34will <wgilmour@hotmail.co.uk>2018-01-11 16:55:23 +0000
committer34will <wgilmour@hotmail.co.uk>2018-01-11 19:51:19 +0000
commita949e98d9b3b77493a0e38e7f2227e57c8c6e066 (patch)
treecd40e1ebb02d3d61e2d3187f4df24f2e1d19fb93 /Source/Core/Common/StringUtil.cpp
parentba111959fa9ac4a40dfb1e7bafe2d2d4a7ef371b (diff)
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.
Diffstat (limited to 'Source/Core/Common/StringUtil.cpp')
-rw-r--r--Source/Core/Common/StringUtil.cpp4
1 files changed, 1 insertions, 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<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