The UTF-8 charset is a superset of the C locale's 7-bit ASCII charset.
Since commit d284ce2fd6 (Initialize character set encoding on program
startup, 2026-02-02, v4.3.0-rc1~40^2) we set a single locale globally.
We can handle archives with UTF-8 paths by running in a locale with a
UTF-8 charset.
Fixes: #25226
Issue: #26903
Issue: #27562
libarchive uses `nl_langinfo(CODESET)` as the host's encoding to convert
path names to/from the archive's encoding. Since commit cd408d93fd (Add
setlocale() calls around use of libarchive APIs, 2015-02-06, v3.1.3~2^2)
we've set `LC_CTYPE` using a scoped locale around libarchive calls to
avoid affecting character classification in the rest of the program.
We've since updated the rest of our code to be locale-independent.
Replace the scoped locale with a single locale established at program
startup. This is more efficient and avoids mutating global state.
Issue: #27562
In commit e419429616 (StdIo: Restore Windows Console I/O modes on
Ctrl-C, 2025-11-26, v4.1.4~4^2) we relied on the compiler to generate a
lambda with an `operator()` for each calling convention. MSVC does
this, but the GNU compiler for MinGW does not seem to.
Extend commit fb3e7825f3 (StdIo: Restore Windows Console I/O modes on
exit, 2025-05-23, v4.1.0-rc1~114^2) to cover termination by Ctrl-C.
Fixes: #27427
Move logic from commit c85524a94a (Ensure stdin, stdout, and stderr pipes
are always open, 2019-05-02, v3.15.0-rc1~171^2) and commit 96010cc968
(Ensure stdin, stdout, stderr FILE streams are open on Windows, 2024-01-24,
v3.29.0-rc1~65^2) to a dedicated source. Expose it through an `Init` class
constructor to make it optionally available during static initialization.
Issue: #26924