summaryrefslogtreecommitdiff
path: root/Source/Core/Common/StringUtil.cpp
diff options
context:
space:
mode:
author34will <wgilmour@hotmail.co.uk>2018-01-11 19:54:16 +0000
committer34will <wgilmour@hotmail.co.uk>2018-01-11 21:49:25 +0000
commit86a787bdf9df5ef54cf38bfd16ae24c73bd9e83c (patch)
tree39d32a9b03a10488de6956ae4987234efd20dbfa /Source/Core/Common/StringUtil.cpp
parenta949e98d9b3b77493a0e38e7f2227e57c8c6e066 (diff)
Modified StringUtil to change UTF16ToUTF8 to use a wstring_convert and codecvt_utf8<wchar_t> to convert a UTF16 wstring to a UTF8 string.
Diffstat (limited to 'Source/Core/Common/StringUtil.cpp')
-rw-r--r--Source/Core/Common/StringUtil.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/Source/Core/Common/StringUtil.cpp b/Source/Core/Common/StringUtil.cpp
index e2a7b7cfb7..8ac8a4a229 100644
--- a/Source/Core/Common/StringUtil.cpp
+++ b/Source/Core/Common/StringUtil.cpp
@@ -29,6 +29,7 @@
constexpr u32 CODEPAGE_SHIFT_JIS = 932;
constexpr u32 CODEPAGE_WINDOWS_1252 = 1252;
#else
+#include <codecvt>
#include <errno.h>
#include <iconv.h>
#include <locale.h>
@@ -564,7 +565,8 @@ std::string UTF8ToSHIFTJIS(const std::string& input)
std::string UTF16ToUTF8(const std::wstring& input)
{
- return CodeToUTF8("UTF-16LE", input);
+ std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> converter;
+ return converter.to_bytes(input);
}
std::string UTF16BEToUTF8(const char16_t* str, size_t max_size)