From 38791eec1879b0a66d6ae920cfd6b42d9ae66dee Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sun, 28 Jun 2020 18:22:18 +0200 Subject: [PATCH] Common: Never convert from UCS-2 in WStringToUTF8 Probably not something we would run into in practice since Windows uses a separate implementation, but let's do it for the sake of correctness. --- Source/Core/Common/StringUtil.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Source/Core/Common/StringUtil.cpp b/Source/Core/Common/StringUtil.cpp index a8880d371b..e3c6f692f6 100644 --- a/Source/Core/Common/StringUtil.cpp +++ b/Source/Core/Common/StringUtil.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -574,7 +575,10 @@ std::string UTF8ToSHIFTJIS(std::string_view input) std::string WStringToUTF8(std::wstring_view input) { - std::wstring_convert, wchar_t> converter; + using codecvt = std::conditional_t, + std::codecvt_utf8>; + + std::wstring_convert converter; return converter.to_bytes(input.data(), input.data() + input.size()); }