diff options
| author | 2023-10-01 16:21:23 -0400 | |
|---|---|---|
| committer | 2023-10-01 19:22:08 -0400 | |
| commit | 38394f36d78f22ca75acf8275e86d25faecd0e8d (patch) | |
| tree | 6c2710b6201abeae3cae96d8e1fa1eccbe92f8ab /src/common | |
| parent | Merge pull request #11646 from FernandoS27/stop-ignoring-your-mental-health (diff) | |
| download | yuzu-38394f36d78f22ca75acf8275e86d25faecd0e8d.tar.gz yuzu-38394f36d78f22ca75acf8275e86d25faecd0e8d.tar.xz yuzu-38394f36d78f22ca75acf8275e86d25faecd0e8d.zip | |
gdbserver: use numeric character references for unicode
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/string_util.cpp | 5 | ||||
| -rw-r--r-- | src/common/string_util.h | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index feab1653d..4c7aba3f5 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp | |||
| @@ -135,6 +135,11 @@ std::u16string UTF8ToUTF16(std::string_view input) { | |||
| 135 | return convert.from_bytes(input.data(), input.data() + input.size()); | 135 | return convert.from_bytes(input.data(), input.data() + input.size()); |
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | std::u32string UTF8ToUTF32(std::string_view input) { | ||
| 139 | std::wstring_convert<std::codecvt_utf8<char32_t>, char32_t> convert; | ||
| 140 | return convert.from_bytes(input.data(), input.data() + input.size()); | ||
| 141 | } | ||
| 142 | |||
| 138 | #ifdef _WIN32 | 143 | #ifdef _WIN32 |
| 139 | static std::wstring CPToUTF16(u32 code_page, std::string_view input) { | 144 | static std::wstring CPToUTF16(u32 code_page, std::string_view input) { |
| 140 | const auto size = | 145 | const auto size = |
diff --git a/src/common/string_util.h b/src/common/string_util.h index c351f1a0c..9da1ca4e9 100644 --- a/src/common/string_util.h +++ b/src/common/string_util.h | |||
| @@ -38,6 +38,7 @@ bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _ | |||
| 38 | 38 | ||
| 39 | [[nodiscard]] std::string UTF16ToUTF8(std::u16string_view input); | 39 | [[nodiscard]] std::string UTF16ToUTF8(std::u16string_view input); |
| 40 | [[nodiscard]] std::u16string UTF8ToUTF16(std::string_view input); | 40 | [[nodiscard]] std::u16string UTF8ToUTF16(std::string_view input); |
| 41 | [[nodiscard]] std::u32string UTF8ToUTF32(std::string_view input); | ||
| 41 | 42 | ||
| 42 | #ifdef _WIN32 | 43 | #ifdef _WIN32 |
| 43 | [[nodiscard]] std::string UTF16ToUTF8(std::wstring_view input); | 44 | [[nodiscard]] std::string UTF16ToUTF8(std::wstring_view input); |