Skip to content

Fix Windows Studio UTF-8 startup handling - #6614

Merged
Imagineer99 merged 10 commits into
unslothai:mainfrom
Imagineer99:fix/windows-studio-utf8
Jul 1, 2026
Merged

Imagineer99 merged 10 commits into
unslothai:mainfrom
Imagineer99:fix/windows-studio-utf8

Conversation

@Imagineer99

@Imagineer99 Imagineer99 commented Jun 23, 2026 •

Copy link
Copy Markdown
Member

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:

  • reconfigure Studio backend stdout/stderr on Windows before startup output
  • make startup banner printing tolerate terminals that cannot encode Unicode
  • read/write adapter config JSON with explicit UTF-8
  • write CLI auth secret text with explicit UTF-8
  • add a cp1252 regression test for the startup banner

Attribution

Original contribution extracted from #6543 by @TheJagStudio.

@gemini-code-assist gemini-code-assist 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.

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.

Comment thread studio/backend/startup_banner.py Resolved
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]>
@Imagineer99
Imagineer99 force-pushed the fix/windows-studio-utf8 branch from 413f99b to d0ae1fd Compare June 23, 2026 15:23
@Imagineer99
Imagineer99 marked this pull request as ready for review June 29, 2026 14:26
@oobabooga

Copy link
Copy Markdown
Member

LGTM to merge as-is.

@LeoBorcherding LeoBorcherding left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

@Imagineer99

Copy link
Copy Markdown
Member Author

CI passes on staging fork, merging.
image

@Imagineer99
Imagineer99 merged commit 482d797 into unslothai:main Jul 1, 2026
44 of 45 checks passed
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.

3 participants