Skip to content

fix(windows): configure stdio as utf-8#2547

Open
lihailong00 wants to merge 1 commit into
MoonshotAI:mainfrom
lihailong00:codex/issue-1436-windows-encoding
Open

fix(windows): configure stdio as utf-8#2547
lihailong00 wants to merge 1 commit into
MoonshotAI:mainfrom
lihailong00:codex/issue-1436-windows-encoding

Conversation

@lihailong00

@lihailong00 lihailong00 commented Jul 23, 2026

Copy link
Copy Markdown

Summary

  • configure Windows stdout/stderr for UTF-8 at CLI startup when the stream supports reconfigure
  • safely leave non-standard or locked streams unchanged
  • avoid force_terminal, so redirected output behavior is not altered

Reproduction and verification

A strict cp936 stream rendering the real welcome logo deterministically raised UnicodeEncodeError on current main. After the fix:

  • uv run pytest tests/core/test_windows_stdio.py tests/core/test_startup_imports.py -q — 11 passed
  • Ruff, Ty, and Pyright — passed

This supersedes closed #1497 while addressing its reviewed redirected-output and encoding=None problems.

Closes #1436


Open in Devin Review

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

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.

Gitbash start kimi failed

1 participant