[Bug]: Windows PowerShell terminal mangles non-ASCII / UTF-8 stdout due to missing Console::OutputEncoding initialization
Before submitting
- [x] I searched existing issues and did not find a duplicate.
- [x] I included enough detail to reproduce or investigate the problem.
Area
apps/server
Steps to reproduce
- On Windows, in any thread with PowerShell terminal execution, run a command that outputs non-ASCII or UTF-8 characters (e.g.
git logwith non-ASCII commit messages, file contents containing Cyrillic, Umlauts, accents, orpython -c "print('Привет мир')"). - Inspect the tool output returned to the agent and rendered in the T3 Code UI.
Expected behavior
Standard UTF-8 text is preserved and rendered accurately (e.g. Привет мир).
Actual behavior
Non-ASCII characters are mangled into replacement characters `` or legacy OEM/ANSI codepage mojibake (e.g. ???).
This occurs because when Node.js spawns powershell.exe on Windows with redirected stdout pipes, PowerShell defaults $OutputEncoding to ASCII/OEM (e.g. CP437, CP866, or Windows-1252), corrupting all multibyte UTF-8 characters before they reach the server buffer.
Impact
Major degradation or frequent failure
Version or commit
T3 Code 0.1.9 / core 0.169.0
Environment
Windows 11 x64, Desktop app, PowerShell 5.1 / PowerShell 7
Workaround & Suggested Fix
Whenever T3 Code spawns a PowerShell process or initializes an interactive terminal on Windows, configure UTF-8 output encoding by prepending:
$OutputEncoding = [Console]::OutputEncoding = [System.Text.Encoding]::UTF8;
[Console]::InputEncoding = [System.Text.Encoding]::UTF8;
chcp 65001 > $null;
And ensure Node.js child_process spawn options specify { encoding: 'utf8', env: { ...process.env, PYTHONIOENCODING: 'utf-8', LC_ALL: 'en_US.UTF-8' } }.