diff options
| author | Anthony <Helios747@users.noreply.github.com> | 2017-11-06 23:11:34 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-11-06 23:11:34 -0800 |
| commit | 835eff15a18fab15ee8c08241dd9b1588dd428ca (patch) | |
| tree | 265c7f03f3b285142567431f3e677713bcfd4824 /Source/Core/Common/StringUtil.cpp | |
| parent | d378811271a75d4b6454c157b1a2e6000ec425d1 (diff) | |
| parent | 1dc2a85ccc2e3a23b9cd33d1503038223bfae320 (diff) | |
Merge pull request #6162 from JosJuice/nand-check-save-game-name
When NAND is damaged, show title names from save files
Diffstat (limited to 'Source/Core/Common/StringUtil.cpp')
| -rw-r--r-- | Source/Core/Common/StringUtil.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Source/Core/Common/StringUtil.cpp b/Source/Core/Common/StringUtil.cpp index 445224757b..c904f150da 100644 --- a/Source/Core/Common/StringUtil.cpp +++ b/Source/Core/Common/StringUtil.cpp @@ -22,6 +22,7 @@ #include "Common/CommonTypes.h" #include "Common/Logging/Log.h" #include "Common/StringUtil.h" +#include "Common/Swap.h" #ifdef _WIN32 #include <Windows.h> @@ -576,3 +577,11 @@ std::string UTF16ToUTF8(const std::wstring& input) } #endif + +std::string UTF16BEToUTF8(const char16_t* str, size_t max_size) +{ + const char16_t* str_end = std::find(str, str + max_size, '\0'); + std::wstring result(static_cast<size_t>(str_end - str), '\0'); + std::transform(str, str_end, result.begin(), static_cast<u16 (&)(u16)>(Common::swap16)); + return UTF16ToUTF8(result); +} |
