Skip to content

fix: use UTF-8 encoding for subprocess output on Windows#90

Open
taipoweredpm wants to merge 1 commit intomicrosoft:mainfrom
taipoweredpm:fix/windows-unicode-encoding
Open

fix: use UTF-8 encoding for subprocess output on Windows#90
taipoweredpm wants to merge 1 commit intomicrosoft:mainfrom
taipoweredpm:fix/windows-unicode-encoding

Conversation

@taipoweredpm
Copy link
Copy Markdown

Summary

Fixes #89 — Unicode characters (emoji, em-dash, etc.) are garbled on Windows when passed between agents or posted via tools.

Root Cause

Python defaults to cp1252 (charmap) encoding on Windows for subprocess pipes and text=True mode. This mangles non-ASCII characters in script output and subprocess calls.

Changes

  • executor/script.py: Set PYTHONUTF8=1 in subprocess env so child Python processes use UTF-8
  • cli/update.py: Added encoding="utf-8" to subprocess.run()
  • mcp_auth.py: Added encoding="utf-8" to subprocess.run()

Testing

All 75 existing tests pass. Lint clean.

On Windows, Python defaults to cp1252 (charmap) encoding for subprocess
pipes and text=True mode. This causes Unicode characters (emoji, em-dash,
etc.) to be garbled when passed between agents or posted via tools.

Changes:
- script.py: Set PYTHONUTF8=1 in subprocess environment so child Python
  processes use UTF-8 instead of system default encoding
- update.py: Add encoding='utf-8' to subprocess.run call
- mcp_auth.py: Add encoding='utf-8' to subprocess.run call

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@taipoweredpm
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree company="Microsoft"

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.

Windows: Unicode characters in agent output are garbled (charmap encoding)

2 participants