fix: add Windows UTF-8 encoding env vars for terminals with fixed tests#11873
Draft
roomote-v0[bot] wants to merge 1 commit intomainfrom
Draft
fix: add Windows UTF-8 encoding env vars for terminals with fixed tests#11873roomote-v0[bot] wants to merge 1 commit intomainfrom
roomote-v0[bot] wants to merge 1 commit intomainfrom
Conversation
Adds Windows-specific UTF-8 environment variables (PYTHONIOENCODING, PYTHONUTF8, RUBYOPT) to both VSCode terminals and Execa terminals to prevent character corruption when the system uses non-UTF-8 encodings like GBK (code page 936). Fixes the test failures from PR #10796 by updating TerminalRegistry tests to conditionally include the Windows-specific env vars based on the platform. Closes #10709
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related GitHub Issue
Closes: #10709
Description
This PR attempts to address Issue #10709 where terminal output exhibits character corruption on Windows systems using non-UTF-8 encodings like GBK (code page 936). This is a follow-up to PR #10796 which had the right approach but failed Windows CI tests.
Changes:
Terminal.ts(getEnv()): On Windows (process.platform === "win32"), addsPYTHONIOENCODING=utf-8,PYTHONUTF8=1, andRUBYOPT=-EUTF-8environment variables.ExecaTerminalProcess.ts: Adds the same UTF-8 encoding environment variables to the execa subprocess env (these are set unconditionally since they are harmless on non-Windows).TerminalRegistry.spec.ts(key fix): The previous PR failed because these tests used exact env object matching. On Windows CI, the new env vars were present but not expected. Fixed by defining aWIN32_UTF8_ENVhelper that conditionally spreads the Windows-specific vars into the expected env objects.ExecaTerminalProcess.spec.ts: Added tests for the new UTF-8 env vars and override behavior.Terminal.getEnv.spec.ts(new): Dedicated tests forTerminal.getEnv()covering platform-conditional behavior.Feedback and guidance are welcome.
Test Procedure
Run the affected tests:
All 26 tests pass. The
TerminalRegistry.spec.tstests now correctly handle both Windows and non-Windows platforms.Pre-Submission Checklist
Documentation Updates
Additional Notes
This supersedes PR #10796 with the same feature implementation plus fixed tests that account for platform-conditional env vars.
Interactively review PR in Roo Code Cloud