mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 13:49:53 -06:00
DolphinQt: Handle non-ASCII characters in Windows cmd arguments
CommandLineParse expects UTF-8 strings. (QApplication, on the other hand, seems to be designed so that you can pass in the char** argv untouched on Windows and get proper Unicode handling.)
This commit is contained in:
@ -16,26 +16,6 @@
|
||||
#include "UpdaterCommon/UI.h"
|
||||
#include "UpdaterCommon/UpdaterCommon.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
std::vector<std::string> CommandLineToUtf8Argv(PCWSTR command_line)
|
||||
{
|
||||
int nargs;
|
||||
LPWSTR* tokenized = CommandLineToArgvW(command_line, &nargs);
|
||||
if (!tokenized)
|
||||
return {};
|
||||
|
||||
std::vector<std::string> argv(nargs);
|
||||
for (int i = 0; i < nargs; ++i)
|
||||
{
|
||||
argv[i] = WStringToUTF8(tokenized[i]);
|
||||
}
|
||||
|
||||
LocalFree(tokenized);
|
||||
return argv;
|
||||
}
|
||||
}; // namespace
|
||||
|
||||
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow)
|
||||
{
|
||||
if (lstrlenW(pCmdLine) == 0)
|
||||
|
Reference in New Issue
Block a user