You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug Report: Windows cmd.exe GBK output displayed as garbled text in bash tool
Bug Description:
When executing Windows native commands (via cmd /c) or system utilities like ipconfig in OpenCode's bash tool on Windows, Chinese characters are displayed as garbled text (mojibake) instead of proper Chinese text.
Steps to Reproduce:
Open OpenCode on Windows 11
Execute the following command in the bash tool:
cmd /c "echo Windows IP 配置"
Observe the output shows garbled characters instead of proper Chinese text
Expected Behavior:
Chinese characters should be displayed correctly.
Actual Behavior:
Chinese characters are displayed as garbled text (mojibake), indicating encoding mismatch.
Technical Details:
The same command works correctly when executed directly in pwsh 7.6.1 terminal, but fails in OpenCode's bash tool:
Environment
Command
Result
pwsh terminal
cmd /c "echo Windows IP 配置"
✅ Correct
OpenCode bash tool
cmd /c "echo Windows IP 配置"
❌ Garbled
OpenCode bash tool
ipconfig
❌ Garbled
Raw byte analysis confirms ipconfig outputs GBK (CP936) encoding, which is standard for Windows system commands.
Root Cause:
OpenCode's bash tool captures cmd.exe output as raw bytes but processes them with incorrect encoding assumption (expecting UTF-8 instead of detecting GBK). PowerShell 7 correctly uses UTF-8 internally, but the OpenCode rendering layer fails to transcode the GBK output from native Windows commands.
Environment:
OpenCode: 1.14.48
Windows: 11
PowerShell: 7.6.1
Shell: PowerShell 7 (confirmed via $PSVersionTable.PSVersion)
Only Windows native commands (.exe files like ipconfig.exe, cmd.exe) have this issue
The problem occurs even when PowerShell 7's encoding is set to UTF-8
File redirection with GBK decoding works: [System.Text.Encoding]::GetEncoding(936).GetString([System.IO.File]::ReadAllBytes("file")) correctly displays Chinese
Suggested Fix:
Implement encoding detection or transcoding for Windows native command output in the bash tool, or add a configuration option to specify the console output encoding (GBK/CP936 for Windows).
This issue might be a duplicate of existing issues. Please check:
fix: PowerShell output encoding for non-ASCII characters on Windows #23636: Same root cause — Windows bash tool outputs garbled text for CJK characters due to GBK/CP936 encoding mismatch on Chinese-locale Windows systems, with the same proposed fix direction (encoding transcoding for PowerShell/cmd output)
Activity
github-actions commentedon May 11, 2026
This issue might be a duplicate of existing issues. Please check:
github-actions commentedon Jul 11, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.