WIN32: Cannot add games from non Ascii path
|Reported by:||ZvikaZ||Owned by:||sluicebox|
When adding a game that has a Hebrew letters (and probably, any other non standard ascii encoding) in its path, the game seems to be detected, an 'edit game' dialog is opened - but it has wrong path in
If the dialog is approved, the game is added to the games list, but grayed out.
When starting the game, it says:
Error running game: Path not a directory.
In Linux (CentOS 7) it works (it has some font problem, so the Hebrew part of the path is shown as blanks under 'Game Path' menu, but that's minor, unrelated, issue).
Note: this is a regression, as it worked at release 2.2.0
Debugging this, I see that at
backends\dialogs\win32\win32-dialogs.cpp , line 93
HRESULT hr = item->GetDisplayName(SIGDN_FILESYSPATH, &name);
name (which is a
LPWSTR) is encoded with UTF-16, and at lines 95-96:
char *str = Win32::unicodeToAnsi(name); path = Common::String(str);
it's transformed to a
Common::String, encoded with Windows-1255 (my local computer encoding).
I think that at this point, it should have been transformed to UTF-8 instead.
Furthermore, there are few functions that translate from
LPWSTR (Windows UTF-16) to local's computer ansi, and back - and I think they should all translate to UTF-8, and back, instead.
https://github.com/scummvm/scummvm/pull/2929 tries to solve this.