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
{{ message }}
Repository navigation
fix: CJK characters garbled in TUI on Windows with non-UTF8 locale #14768
On Windows systems with Chinese/Japanese/Korean locales, CJK characters (中文、日本語、한국어) appear garbled in the OpenCode TUI input box. This happens because Windows console defaults to local code pages (e.g., GBK 936 for Chinese Windows) instead of UTF-8.
Reproduction
Use Windows with Chinese locale (or any non-UTF-8 locale)
Run opencode in terminal
Try typing CJK characters in the TUI input box
Observe garbled text or unexpected character insertion
Expected behavior
CJK characters should display correctly as UTF-8 in the TUI input box.
Environment
OS: Windows 10/11
Locale: zh-CN, ja-JP, ko-KR
OpenCode version: latest
Root cause
Windows console code page is not set to UTF-8 (65001) before TUI initialization. The console uses the system's default code page (e.g., 936 for Chinese GBK), causing UTF-8 encoded CJK characters to be misinterpreted.
Proposed fix
Call SetConsoleCP(CP_UTF8) and SetConsoleOutputCP(CP_UTF8) Windows API functions in win32.ts and invoke them in TUI entry points (thread.ts and attach.ts).
Please review the above issues to see if your problem is already tracked. If your issue is distinct (specifically about the SetConsoleCP/SetConsoleOutputCP fix not being applied at TUI initialization), feel free to clarify how it differs.
Activity
github-actions commentedon Feb 23, 2026
This issue might be a duplicate of existing issues. Please check:
Please review the above issues to see if your problem is already tracked. If your issue is distinct (specifically about the
SetConsoleCP/SetConsoleOutputCPfix not being applied at TUI initialization), feel free to clarify how it differs.skywalker-35 commentedon Mar 27, 2026
I'm helping with downstream documentation for the encoding issue. Any updates on the proposed fix (SetConsoleCP/OutputCP)?
PhoenixZeng commentedon Apr 20, 2026
opencode app也有类似的问题 表现于在 执行shell命令的回显上 其他地方倒是能正常显示 (那也只是因为代码文件通常用utf8编写 如果是非UTF8的特殊脚本应该也不可以)
github-actions commentedon Jul 4, 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.