diff options
| author | 2021-02-08 02:55:43 -0500 | |
|---|---|---|
| committer | 2021-02-08 02:56:07 -0500 | |
| commit | ff58ad205040bc83bd68197184677055e3e2a313 (patch) | |
| tree | 2ffe2636170f954878334b98bc60accb41ca83db /src/common/string_util.cpp | |
| parent | Merge pull request #5339 from german77/interactive (diff) | |
| download | yuzu-ff58ad205040bc83bd68197184677055e3e2a313.tar.gz yuzu-ff58ad205040bc83bd68197184677055e3e2a313.tar.xz yuzu-ff58ad205040bc83bd68197184677055e3e2a313.zip | |
string_util: Remove MSVC workaround for converting between UTF8/UTF16
This has been fixed as of Visual Studio 2019 Version 16.2
Diffstat (limited to 'src/common/string_util.cpp')
| -rw-r--r-- | src/common/string_util.cpp | 14 |
1 files changed, 0 insertions, 14 deletions
diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index 4cba2aaa4..7b614ad89 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp | |||
| @@ -141,27 +141,13 @@ std::string ReplaceAll(std::string result, const std::string& src, const std::st | |||
| 141 | } | 141 | } |
| 142 | 142 | ||
| 143 | std::string UTF16ToUTF8(const std::u16string& input) { | 143 | std::string UTF16ToUTF8(const std::u16string& input) { |
| 144 | #ifdef _MSC_VER | ||
| 145 | // Workaround for missing char16_t/char32_t instantiations in MSVC2017 | ||
| 146 | std::wstring_convert<std::codecvt_utf8_utf16<__int16>, __int16> convert; | ||
| 147 | std::basic_string<__int16> tmp_buffer(input.cbegin(), input.cend()); | ||
| 148 | return convert.to_bytes(tmp_buffer); | ||
| 149 | #else | ||
| 150 | std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> convert; | 144 | std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> convert; |
| 151 | return convert.to_bytes(input); | 145 | return convert.to_bytes(input); |
| 152 | #endif | ||
| 153 | } | 146 | } |
| 154 | 147 | ||
| 155 | std::u16string UTF8ToUTF16(const std::string& input) { | 148 | std::u16string UTF8ToUTF16(const std::string& input) { |
| 156 | #ifdef _MSC_VER | ||
| 157 | // Workaround for missing char16_t/char32_t instantiations in MSVC2017 | ||
| 158 | std::wstring_convert<std::codecvt_utf8_utf16<__int16>, __int16> convert; | ||
| 159 | auto tmp_buffer = convert.from_bytes(input); | ||
| 160 | return std::u16string(tmp_buffer.cbegin(), tmp_buffer.cend()); | ||
| 161 | #else | ||
| 162 | std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> convert; | 149 | std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> convert; |
| 163 | return convert.from_bytes(input); | 150 | return convert.from_bytes(input); |
| 164 | #endif | ||
| 165 | } | 151 | } |
| 166 | 152 | ||
| 167 | #ifdef _WIN32 | 153 | #ifdef _WIN32 |