KhronosGroup / KTX-Software

KTX (Khronos Texture) Library and Tools
Other
861 stars 225 forks source link

ktx tools do not handle unicode file names on Windows #781

Closed MarkCallow closed 10 months ago

MarkCallow commented 11 months ago

If you try to open a file with a name that includes characters needing more than 8-bits to represent then the open fails with an error message like:

ktx info fatal: Could not open input file "???????.ktx2": invalid argument.

The actual file name is this case was スカイボックス.ktx2.

In fairness the legacy tools are broken. Building with _UNICODE defined causes a compile error. I was alerted to this by #764 and am working on a fix. For the legacy tools we will need to define _UNICODE when building the Windows packages.

aqnuep commented 11 months ago

This may not be as simple as adding _UNICODE or enabling wide-string support in MSVC, as it can have wider implications across the entire software stack. Unfortunately, unicode support in Windows is quite a mess.

We certainly should look into it sooner or later.

MarkCallow commented 11 months ago

This may not be as simple as adding _UNICODE

It isn't. The ktxtools target compilation fails when _UNICODE is defined. I'm working on fixing the legacy tools. We can judge from there how wide the implications will be.

aqnuep commented 11 months ago

It isn't. The ktxtools target compilation fails when _UNICODE is defined. I'm working on fixing the legacy tools. We can judge from there how wide the implications will be.

Sure, what I meant it that it also may not be as simple as fixing the compilation issues. I had my fair share of pain in the past with various Windows unicode support related quirks. We'd have to do an initial investigation and see how it may affect the tests. Now that we have good coverage it should make it easier to get confidence with any solution. We may also want to add unicode file tests, but that could also be another painful trip to get them running across all platforms :)