6 Commits
Author SHA1 Message Date
Brad King 40bcc1e9d5 On program startup in C locale, switch to UTF-8 charset if possible
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
2026-03-13 09:28:12 -04:00
Brad King d284ce2fd6 Initialize character set encoding on program startup
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
2026-02-11 11:55:59 -05:00
Brad King c55dfbf656 StdIo: Restore compilation on 32-bit MinGW
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.
2025-12-11 10:52:18 -05:00
Brad King e419429616 StdIo: Restore Windows Console I/O modes on Ctrl-C
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
2025-11-26 15:18:03 -05:00
Brad King d6a1ff59f1 StdIo: Provide metadata about stdin, stdout, stderr streams
Detect the kind of terminal to which they are attached, if any.

Issue: #26924
2025-05-11 09:13:16 -04:00
Brad King cef4676d3a StdIo: Factor out helper to initialize stdin, stdout, and stderr
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
2025-05-08 13:39:48 -04:00