summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2015-08-04 05:23:26 +0200
committerbunnei <bunneidev@gmail.com>2015-08-04 05:23:26 +0200
commit4d086a4db4a5c8e8cff0631bf144f4f5359221e0 (patch)
tree395b80a0db70b77e0a1cf7bfb3ac2b2b05329553 /src
parentMerge pull request #999 from LittleWhite-tb/qt-save-location (diff)
parentCommon: Work around bug in MSVC2015 standard library (diff)
downloadyuzu-4d086a4db4a5c8e8cff0631bf144f4f5359221e0.tar
yuzu-4d086a4db4a5c8e8cff0631bf144f4f5359221e0.tar.gz
yuzu-4d086a4db4a5c8e8cff0631bf144f4f5359221e0.tar.bz2
yuzu-4d086a4db4a5c8e8cff0631bf144f4f5359221e0.tar.lz
yuzu-4d086a4db4a5c8e8cff0631bf144f4f5359221e0.tar.xz
yuzu-4d086a4db4a5c8e8cff0631bf144f4f5359221e0.tar.zst
yuzu-4d086a4db4a5c8e8cff0631bf144f4f5359221e0.zip
Diffstat (limited to '')
-rw-r--r--src/common/string_util.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp
index b2f7f7b1d..6d6fc591f 100644
--- a/src/common/string_util.cpp
+++ b/src/common/string_util.cpp
@@ -296,14 +296,28 @@ std::string ReplaceAll(std::string result, const std::string& src, const std::st
std::string UTF16ToUTF8(const std::u16string& input)
{
+#if _MSC_VER >= 1900
+ // Workaround for missing char16_t/char32_t instantiations in MSVC2015
+ std::wstring_convert<std::codecvt_utf8_utf16<__int16>, __int16> convert;
+ std::basic_string<__int16> tmp_buffer(input.cbegin(), input.cend());
+ return convert.to_bytes(tmp_buffer);
+#else
std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> convert;
return convert.to_bytes(input);
+#endif
}
std::u16string UTF8ToUTF16(const std::string& input)
{
+#if _MSC_VER >= 1900
+ // Workaround for missing char16_t/char32_t instantiations in MSVC2015
+ std::wstring_convert<std::codecvt_utf8_utf16<__int16>, __int16> convert;
+ auto tmp_buffer = convert.from_bytes(input);
+ return std::u16string(tmp_buffer.cbegin(), tmp_buffer.cend());
+#else
std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> convert;
return convert.from_bytes(input);
+#endif
}
static std::string UTF16ToUTF8(const std::wstring& input)