HarbourMasters / 2ship2harkinian

Creative Commons Zero v1.0 Universal
835 stars 69 forks source link

Allow non-ascii characters in filepath on Windows #743

Closed balloondude2 closed 2 months ago

balloondude2 commented 4 months ago

This PR fixes Issue #525 and allows 2ship to properly launch when there are non-ascii characters (such as þ) in the file path. I'm not sure if this was a Windows-only problem, but Windows is the only thing I can test.

I'm not sure if I put the changes in the best spot (src > code > main.c), so I'm open to moving those lines somewhere else if it's more appropriate.

Before: before

After: after

Build Artifacts

Archez commented 3 months ago

I've tried to do some reading around this and other options. I found two main links from Microsoft about this:

Both achieve similar goals in different ways. The manifest one "feels" like a better approach in the sense that UTF-8 is enabled the moment the program executes, where as setLocale isn't valid until it is called in code at runtime. However, the manifest change requires users to be on a specific version of Windows to leverage it, where as setLocale can be statically linked so that it supports more Windows versions.

Considering you call setLocale basically as early as possible, I think it would probably be safe to just try this first and see if user reports die down.