Windows: product names, the editors, WSL; the Linux page's image step

Assembled from development commit c3c40f6c8fca. Since 830b193: on Windows the
products carry Windows names (ktext.exe, klammertext.dll, document.dll,
reflect.dll) and the console's output code page is UTF-8 for a run; the
editor tooling works on Windows (VS Code, Sublime Text, Vim, with the
interpreter's name chosen by platform) and Notepad++ joins it
(doc/edit/notepadpp: a User Defined Language and two Run-menu commands);
a sixth install page, doc/install/windows_wsl_install.md, for Linux
inside WSL; the Windows page opens with the three routes and gains its
editor section, the PowerShell quoting and Path notes; the Linux page
installs OpenImageIO from the python3-openimageio package and verifies
with kdiag --machine; the README lists all six install pages. Linux and
macOS behaviour is unchanged.
This commit is contained in:
ack committed 2026-09-25 18:43:22 +02:00
1 parent 830b19394d
commit ee8bcf5300
33 files changed
+741 -122

No files matched your search

+31
View File
@@ -1,7 +1,11 @@
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#include <windows.h>
#include <fcntl.h>
#include <io.h>
#endif
#include <cstdlib>
#include <tuple>
#include "argv.h"
@@ -39,6 +43,26 @@ void set_verbose_level(int argc, char* argv[])
// byte. The C runtime's text mode would append it to every line.
_setmode(_fileno(stdout), _O_BINARY);
_setmode(_fileno(stderr), _O_BINARY);
// A console decodes what a program writes in the CONSOLE's output code
// page, which on a localized Windows is an OEM page (850 on a German one)
// and never UTF-8, whatever the process's own code page (the manifest
// makes that UTF-8). The commands write UTF-8 -- kdesc --katoms's
// ⟨name⟩, an error report's ⟨katom⟩ -- so a console showed three cp850
// characters per symbol while a file or a pipe received the right bytes
// (which is why no suite saw it; Andy did, 2026-09-25). Switch the
// console to UTF-8 while a command runs, when a stream is a console, and
// put it back at exit: the page belongs to the console, not the process,
// and would outlive it.
static UINT console_output_cp = 0;
static UINT console_output_cp_now = 0;
if (_isatty(_fileno(stdout)) || _isatty(_fileno(stderr))) {
console_output_cp = GetConsoleOutputCP();
if (console_output_cp != 0 && console_output_cp != CP_UTF8) {
SetConsoleOutputCP(CP_UTF8);
console_output_cp_now = GetConsoleOutputCP();
std::atexit([] { SetConsoleOutputCP(console_output_cp); });
}
}
#endif
//command_name = absolute_pathname(argv[0]);
command_name = fs::path(argv[0]).generic_string();
@@ -49,6 +73,13 @@ void set_verbose_level(int argc, char* argv[])
args.opt("v", "'verbosity'", "level", "0", "'verbosity'");
args.parse(argc, argv, false);
verbose_level = args.as_verbosity("v");
#ifdef _WIN32
if (console_output_cp != 0 && console_output_cp != CP_UTF8) {
K::log(1, "Console output code page set to UTF-8 for this run (was "
+ std::to_string(console_output_cp) + ", now "
+ std::to_string(console_output_cp_now) + ")");
}
#endif
}
bool show_usage(int argc, char* argv[])