From 4c8a98a321f744d5935a9b864549b550942d1b83 Mon Sep 17 00:00:00 2001 From: SachinVin <26602104+SachinVin@users.noreply.github.com> Date: Sun, 18 Jun 2023 22:30:00 +0530 Subject: [PATCH] common\string_util.cpp: switch to boost::locale::conv for UTF16ToUTF8() and UTF8ToUTF16() (#6623) --- externals/boost | 2 +- src/common/CMakeLists.txt | 5 ----- src/common/string_util.cpp | 10 +++++----- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/externals/boost b/externals/boost index 80a171a17..32f5cd8eb 160000 --- a/externals/boost +++ b/externals/boost @@ -1 +1 @@ -Subproject commit 80a171a179c1f901e4f8dfc8962417f44865ceec +Subproject commit 32f5cd8ebb35b29ccb3860861bd285f80804bc85 diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 7c3e3f841..f9fb13efb 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -139,11 +139,6 @@ add_library(citra_common STATIC ) if (MSVC) - target_compile_definitions(citra_common PRIVATE - # The standard library doesn't provide any replacement for codecvt yet - # so we can disable this deprecation warning for the time being. - _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING - ) target_compile_options(citra_common PRIVATE /W4 diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index c8257a343..0b5e19858 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp @@ -4,12 +4,14 @@ #include #include -#include #include #include #include #include #include + +#include + #include "common/common_paths.h" #include "common/logging/log.h" #include "common/string_util.h" @@ -155,13 +157,11 @@ std::string ReplaceAll(std::string result, const std::string& src, const std::st } std::string UTF16ToUTF8(std::u16string_view input) { - std::wstring_convert, char16_t> convert; - return convert.to_bytes(input.data(), input.data() + input.size()); + return boost::locale::conv::utf_to_utf(input.data(), input.data() + input.size()); } std::u16string UTF8ToUTF16(std::string_view input) { - std::wstring_convert, char16_t> convert; - return convert.from_bytes(input.data(), input.data() + input.size()); + return boost::locale::conv::utf_to_utf(input.data(), input.data() + input.size()); } #ifdef _WIN32