8000 Use UTF-8 as process code page on Windows by zotabee · Pull Request #416 · rockdaboot/wget2 · GitHub
[go: up one dir, main page]

Skip to content

Use UTF-8 as process code page on Windows - #416

Open
zotabee wants to merge 1 commit into
rockdaboot:masterfrom
zotabee:windows-utf8-manifest
Open

zotabee wants to merge 1 commit into
rockdaboot:masterfrom
zotabee:windows-utf8-manifest

Conversation

@zotabee
@zotabee zotabee commented Nov 13, 2026
Copy link
Copy Markdown
Contributor

On Windows, file names with characters outside the system code page are saved as mojibake: with code page 1252 and --restrict-file-names=nocontrol, пример.txt becomes пример.txt, and Japanese names fare the same ("Failed to transcode 'utf-8' string into 'CP1252'"). This is the rest of #388 after #399 and #400.

  • An application manifest sets UTF-8 as the process code page (activeCodePage, Windows 10 1903 and later; older versions ignore it). configure looks for windres on MinGW and links src/wget2.rc into wget2.exe and wget2_noinstall.exe.
  • With it, café.txt, пример.txt and 日本語.txt are saved correctly with nocontrol and windows,nocontrol. With the default windows restriction, escaped names change from the local code page to UTF-8 (caf%E9.txt becomes caf%C3%A9.txt).
  • Windows now hands wget2 its command line in UTF-8, so --local-encoding other than UTF-8 no longer applies to command-line IRIs. test-idn-cmd and test-idn-robots pass EUC-JP on the command line and are skipped on Windows with the manifest, like test-iri.

Tested on Windows 11 (static build, code page 1252), under wine in the buildenv-wget2-mingw image (no new failures), and make check on Debian (unchanged, 112/112).

* src/wget2.manifest: New application manifest with activeCodePage UTF-8.
* src/wget2.rc: New file, links the manifest as resource.
* src/Makefile.am: Link wget2.rc into the executables if windres is found.
* configure.ac: Check for windres on MinGW, define WINDOWS_UTF8_MANIFEST.
* tests/test-idn-cmd.c, tests/test-idn-robots.c: Skip on Windows with the
  manifest, the EUC-JP command line can't get through.

wget2 passes UTF-8 file names to the ANSI file functions, so names with
characters outside the Windows code page (e.g. Cyrillic or Japanese with
code page 1252) were saved as mojibake with --restrict-file-names=nocontrol.
Windows 10 1903 and later honor the manifest, older versions ignore it.

Copyright-paperwork-exempt: Yes
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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

0