Merge pull request #6298 from 34will/feature/Android_Single_Char_Fix
[Android] Fix for single char name for Wii and WAD Games
This commit is contained in:
commit
56d74d65d0
|
@ -29,6 +29,7 @@
|
||||||
constexpr u32 CODEPAGE_SHIFT_JIS = 932;
|
constexpr u32 CODEPAGE_SHIFT_JIS = 932;
|
||||||
constexpr u32 CODEPAGE_WINDOWS_1252 = 1252;
|
constexpr u32 CODEPAGE_WINDOWS_1252 = 1252;
|
||||||
#else
|
#else
|
||||||
|
#include <codecvt>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <iconv.h>
|
#include <iconv.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
@ -472,6 +473,14 @@ std::string CP1252ToUTF8(const std::string& input)
|
||||||
return UTF16ToUTF8(CPToUTF16(CODEPAGE_WINDOWS_1252, input));
|
return UTF16ToUTF8(CPToUTF16(CODEPAGE_WINDOWS_1252, input));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -556,15 +565,14 @@ std::string UTF8ToSHIFTJIS(const std::string& input)
|
||||||
|
|
||||||
std::string UTF16ToUTF8(const std::wstring& input)
|
std::string UTF16ToUTF8(const std::wstring& input)
|
||||||
{
|
{
|
||||||
return CodeToUTF8("UTF-16LE", input);
|
std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> converter;
|
||||||
|
return converter.to_bytes(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
std::string UTF16BEToUTF8(const char16_t* str, size_t max_size)
|
std::string UTF16BEToUTF8(const char16_t* str, size_t max_size)
|
||||||
{
|
{
|
||||||
const char16_t* str_end = std::find(str, str + max_size, '\0');
|
const char16_t* str_end = std::find(str, str + max_size, '\0');
|
||||||
std::wstring result(static_cast<size_t>(str_end - str), '\0');
|
return CodeToUTF8("UTF-16BE", std::u16string(str, static_cast<size_t>(str_end - str)));
|
||||||
std::transform(str, str_end, result.begin(), static_cast<u16 (&)(u16)>(Common::swap16));
|
|
||||||
return UTF16ToUTF8(result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue