Skip to content

fix(cli): render Unicode output with legacy encodings - #826

Open
Bortlesboat wants to merge 1 commit into
tirth8205:mainfrom
Bortlesboat:fix/windows-legacy-stdout
Open

fix(cli): render Unicode output with legacy encodings#826
Bortlesboat wants to merge 1 commit into
tirth8205:mainfrom
Bortlesboat:fix/windows-legacy-stdout

Conversation

@Bortlesboat

Copy link
Copy Markdown

Summary

On Windows and redirected streams configured as CP1252, the CLI could raise UnicodeEncodeError before showing its banner or graph summaries because those views use box-drawing characters. Reconfigurable standard streams now switch to UTF-8 at startup, while UTF-8, encoding-less, and non-reconfigurable streams keep their existing behavior.

Validation

  • Reproduced the crash on clean main with a CP1252 TextIOWrapper before applying the fix.
  • The real main() regression passes on Python 3.10 and 3.13 and verifies both stdout and stderr.
  • tests/test_cli.py: 18 passed; the one deselected test is an existing Windows failure reproduced on clean main.
  • Full Windows suite: 2,353 passed; 37 unrelated platform or fixture failures, with representative cases reproduced on clean main.
  • Ruff, targeted mypy, and the configured Bandit scan pass.
  • Real processes launched with PYTHONIOENCODING=cp1252 render both the startup banner and graph summaries and exit successfully.

Post-Deploy Monitoring & Validation

No additional operational monitoring is required because this changes local CLI output and has no deployed service surface. During review and the next Windows release, a healthy run exits successfully and renders readable Unicode when PYTHONIOENCODING=cp1252; UnicodeEncodeError, charmap, or unreadable redirected output are failure signals. Revert this commit to restore the previous stream behavior if those signals appear.


Compound Engineering

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant