diff --git a/Source/Core/Common/StringUtil.cpp b/Source/Core/Common/StringUtil.cpp index 265679feb9..326a8e19eb 100644 --- a/Source/Core/Common/StringUtil.cpp +++ b/Source/Core/Common/StringUtil.cpp @@ -563,11 +563,9 @@ std::string UTF8ToSHIFTJIS(std::string_view input) std::string WStringToUTF8(std::wstring_view input) { - using codecvt = std::conditional_t, - std::codecvt_utf8>; - - std::wstring_convert converter; - return converter.to_bytes(input.data(), input.data() + input.size()); + // Note: Without LE iconv expects a BOM. + // The "WCHAR_T" code would be appropriate, but it's apparently not in every iconv implementation. + return CodeToUTF8((sizeof(wchar_t) == 2) ? "UTF-16LE" : "UTF-32LE", input); } std::string UTF16BEToUTF8(const char16_t* str, size_t max_size)