Skip to content

Hand the engine UTF-8, not the ANSI codepage#28

Merged
xroche merged 4 commits into
masterfrom
fix/gui-argv-utf8
Jul 15, 2026
Merged

Hand the engine UTF-8, not the ANSI codepage#28
xroche merged 4 commits into
masterfrom
fix/gui-argv-utf8

Conversation

@xroche

@xroche xroche commented Jul 14, 2026

Copy link
Copy Markdown
Owner

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 calls hts_main2() directly, so an accented path or non-Latin URL arrived as ANSI. Shell.cpp now converts it. --selftest exercises 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.

xroche and others added 2 commits July 14, 2026 20:12
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>
xroche and others added 2 commits July 14, 2026 20:42
…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>
@xroche
xroche merged commit 8a26227 into master Jul 15, 2026
3 checks passed
@xroche
xroche deleted the fix/gui-argv-utf8 branch July 15, 2026 05:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant