From da7c813edf729276093abc039d084014ce330096 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Wed, 15 Oct 2025 18:12:40 -0500 Subject: [PATCH] StringUtil: Make non-Windows WStringToUTF8 implementation use iconv instead of deprecated std::codecvt features. --- Source/Core/Common/StringUtil.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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)