Commit Graph
2 Commits
Author SHA1 Message Date
XYZ 929f7125b8 Windows: encode and decode text as UTF-8 instead of trusting the locale
setlocale(LC_ALL, "") maps to the ANSI code page on Windows -- 936 (GBK)
on a Chinese system -- so wcrtomb() produces GBK where the protocol wants
UTF-8, and mbrtowc() reads UTF-8 as GBK. Typed Chinese therefore reached
the model as mojibake, and once the buffer held correct UTF-8 the input
line rendered as mojibake instead. Windows' C runtime has no ".UTF-8"
locale to switch to, so the conversion has to be explicit.

os_compat.[ch]
  * add os_utf8_encode() and os_utf8_decode(), locale-independent, with
    range and overlong-form checks
src/tui.c
  * input_put_wc(), the command-palette filter and the ask_user buffer use
    os_utf8_encode() instead of wcrtomb()
src/textsel.c
  * cst_utf8_decode() uses os_utf8_decode() instead of mbrtowc()
2026-10-06 17:56:55 +08:00
XYZ 3db33eddac Windows: make the CMake build work with MSYS2's native toolchain
ci / linux (clang) (pull_request) Canceled after 0s
ci / linux (gcc) (pull_request) Canceled after 0s
ci / sanitizers (pull_request) Canceled after 0s
ci / musl (pull_request) Canceled after 0s
ci / macos (pull_request) Canceled after 0s
2026-10-06 16:13:45 +08:00