Support Unicode file paths in the Windows CLI - #452
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
As already Windows 10 is EOL, it might not be worth carrying this wide vs narrow legacy cruft around. A more elegant/modern solution is to use ultrahdr apps (and other clients of the library) in the native UTF-8 code page. See e.g. AOMediaCodec/libavif@3ec01ce |
|
Thanks for the suggestion—the UTF-8 manifest is a cleaner approach for modern Windows, and the libavif precedent is helpful. There is one compatibility tradeoff:
Microsoft documents the version requirement here: @DichenZhang1 Would the maintainers prefer the simpler manifest approach and effectively require Windows 10 1903+, or retain the explicit conversion for broader Windows compatibility? I’m happy to revise the PR either way and will keep the existing Windows Unicode regression test to verify the chosen implementation. |
Only on mission critical equipment like medical devices etc. I don't think they'd be deploying new (read "not yet withstood the test of time") features and libraries like libultrahdr on those. |
|
@kmilos Thank you, helpful context. I like your proposal and agree it seems simpler and a good approach. I would like to hear if the maintainers have a preference, I'm happy to revise the approach but just want to confirm direction. |
Summary
std::filesystem::u8path()on Windows.Why
The Windows narrow
argvand file-stream paths use the active system code page. Valid filenames outside that code page can be replaced with?, causing the CLI to reject files that exist or fail to create the requested output.This change preserves the original Unicode path while leaving the existing CLI parser and command-line interface unchanged.
Scope
This affects only filesystem access in the Windows sample CLI. The library API and ABI are unchanged, and non-Windows behavior is unchanged. Windows reserved filenames, long-path policy, and legacy-console rendering are outside this PR's scope.
Addresses the filesystem-access failure reported in #379.
Validation
Tested natively on Windows x64 with Visual Studio 2022 17.14.2, MSVC 19.44, and CMake 3.31.6:
?and encoding failed.HEIF/x265 were disabled because they are unrelated to CLI filesystem handling.