Open jaku opened 4 months ago
This could be considered a "bug" in Lua itself. https://github.com/lua/lua/blob/c1dc08e8e8e22af9902a6341b4a9a9a7811954cc/loadlib.c#L428 fopen is used check if the file exist. This is bad on Windows as if non-ASCII UTF-8 is passed here, it usually doesn't work, as Windows has it use the local codepage rather than UTF-8 by default. A UTF-8 string here has to be converted into UTF-16 then the w* APIs must be used.
Presumingly this bug would not occur on Linux with a similar directory structure (since that actually uses UTF-8 typically).
So the solution is to set the UTF-8 codepage globally in windows
Summary
If Bizhawk is running from a folder with a accented character like é, and LUA scripts loaded that are looking for socket.core functionality are used, it will throw an error about being unable to find DLLs that would otherwise load just fine.
Repro
Note: The lua files can be inside the accented folder or not. But if just the lua files are in the accented folder and bizhawk is not, things work fine.
Output
Host env.