Repository navigation
Fix Windows Studio UTF-8 startup handling - #6614
Conversation
There was a problem hiding this comment.
Code Review
This pull request improves encoding robustness across the codebase, particularly on Windows environments, by explicitly specifying UTF-8 encoding when opening files and reconfiguring standard output/error streams. It also introduces a safe print utility in the startup banner to prevent crashes when printing non-ASCII characters to terminals with limited encoding support. The review feedback suggests defensively catching a LookupError in the safe print function in case the system stdout encoding is unrecognized, falling back to ASCII.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Extracted and narrowed from unslothai#6543 by @TheJagStudio. This keeps the startup/banner and text file encoding hardening separate from the already-merged Python code-exec UTF-8 fix in unslothai#6548. Co-authored-by: Jagrat Patel <[email protected]>
413f99b to
d0ae1fd
Compare
|
LGTM to merge as-is. |
LeoBorcherding
left a comment
There was a problem hiding this comment.
lgtm, approving. tested locally on windows, studio comes up clean and the banner prints without crashing, new tests pass (5/5).
like the layered approach. reconfiguring stdout/stderr to utf-8 early in main.py before anything prints, then _safe_print as a backstop for streams that can't be reconfigured, with the ASCII fallback on LookupError. and the explicit encoding="utf-8" on the adapter_config.json and auth secret writes is the right call since those were inheriting the legacy code page.
one optional nit, nothing blocking: with errors="replace" the sloth emoji comes out as a replacement char on a real legacy console instead of rendering. fine tradeoff, just noting it as known behavior.

Summary
Extracts and narrows the Windows UTF-8 startup/file I/O hardening from #6543 by @TheJagStudio.
This keeps the fix scoped to surfaces that are separate from the already-merged Python code-execution subprocess fix in #6548:
Attribution
Original contribution extracted from #6543 by @TheJagStudio.