Hand the engine UTF-8, not the ANSI codepage#28
Merged
Conversation
The engine reads every char* as UTF-8 on Windows -- its own main() runs the command line through hts_argv_utf8() first. The GUI never goes through that: it builds its own argv from MFC dialog strings and calls hts_main2() directly, so an accented project path or a non-Latin URL arrived as ANSI bytes that are not valid UTF-8. Convert them. Nothing else can test this -- the path is only reachable by typing into a dialog -- so --selftest exercises the conversion, and CI asserts it ran rather than merely that it did not fail. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…give
lpUsedDefaultChar must be NULL when the code page is CP_UTF8, or the call fails
outright. A UTF-8 ANSI codepage ("Beta: Use Unicode UTF-8") is exactly a configuration
this check has to keep working in -- instead it would have skipped, and the CI gate that
requires the check to run would then have failed the build blaming the wrong thing.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The engine reads every
char*as UTF-8 on Windows (xroche/httrack#573), but the GUI builds its own argv from MFC dialog strings and callshts_main2()directly, so an accented path or non-Latin URL arrived as ANSI.Shell.cppnow converts it.--selftestexercises the conversion and CI asserts it ran.Existing projects under an accented path will re-mirror: the GUI wrote the profile to the right directory while the engine mirrored into a mojibake one, and this makes them agree. One for the release notes.