mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-18 16:21:39 +00:00
Eliminate the wstring game name.
Some cleanup throughout related code. (try to make logic in ISOFile understandable by a human) Encode strings in UTF-8 rather than somehow trying to determine the encoding in the GUI code. Non-windows OSes temporarily broken.
This commit is contained in:
parent
2b1af36900
commit
6c8adf6130
22 changed files with 243 additions and 411 deletions
|
@ -395,17 +395,41 @@ std::string UTF16ToUTF8(const std::wstring& input)
|
|||
return output;
|
||||
}
|
||||
|
||||
std::wstring UTF8ToUTF16(const std::string& input)
|
||||
std::wstring CPToUTF16(u32 code_page, const std::string& input)
|
||||
{
|
||||
auto const size = MultiByteToWideChar(CP_UTF8, 0, input.data(), input.size(), nullptr, 0);
|
||||
auto const size = MultiByteToWideChar(code_page, 0, input.data(), input.size(), nullptr, 0);
|
||||
|
||||
std::wstring output;
|
||||
output.resize(size);
|
||||
|
||||
if (size != MultiByteToWideChar(CP_UTF8, 0, input.data(), input.size(), &output[0], output.size()))
|
||||
if (size != MultiByteToWideChar(code_page, 0, input.data(), input.size(), &output[0], output.size()))
|
||||
output.clear();
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
std::wstring UTF8ToUTF16(const std::string& input)
|
||||
{
|
||||
return CPToUTF16(CP_UTF8, input);
|
||||
}
|
||||
|
||||
std::string SHIFTJISToUTF8(const std::string& input)
|
||||
{
|
||||
return UTF16ToUTF8(CPToUTF16(932, input));
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
std::string UTF16ToUTF8(const std::wstring& input)
|
||||
{
|
||||
// TODO: implement
|
||||
return std::string();
|
||||
}
|
||||
|
||||
std::string SHIFTJISToUTF8(const std::string& input)
|
||||
{
|
||||
// TODO: implement
|
||||
return std::string();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue