fix(cli): detect the active Windows code page - #70
Conversation
Probe cmd.exe for the active console code page before falling back to canonical locale detection, and cover localized output, failure paths, and cache behavior. Model: GPT-5
|
This PR predates the contribution-intake policy introduced in #91. I opened #115 with the reproduction and proposed scope, and I am waiting for explicit maintainer agreement before updating the branch or converting the body to the current template. While revalidating the existing patch, I found and prepared a fix for an executable-trust issue: the follow-up no longer derives Prepared validation: 48 focused tests passed, CLI typecheck passed, Oxlint and Prettier passed, |
Related issue
Closes #115
Problem / pressure
Windows child processes can emit bytes in the active console code page. The CLI currently guesses from locale variables, so a zh-SG host with C.UTF-8 variables can fall back to CP437 and corrupt terminal or command output.
Summary
Before / after
Test plan
corepack pnpm --dir apps/cli exec vitest run src/utils/encoding.test.ts tests/terminal-manager.test.ts(55 passed)corepack pnpm --dir apps/cli typecheckcorepack pnpm exec oxlint --type-aware apps/cli/src/utils/encoding.ts apps/cli/src/utils/encoding.test.ts(0 warnings/errors)corepack pnpm exec prettier --check apps/cli/src/utils/encoding.ts apps/cli/src/utils/encoding.test.tsgit diff --check origin/main...HEADContext handoff
Instructions for reviewing agents
Authoring context