Bug Report: Chinese IME input shows underscores in TUI on Windows
Environment
| Item |
Value |
| OpenCode version |
1.15.12 |
| OS |
Windows 11 Pro Insider Preview (Build 26220) |
| Terminal |
Windows Terminal |
| Shell |
PowerShell 7.6.2 |
| Node.js |
v26.2.0 |
| System code page |
65001 (UTF-8) |
| Input method |
Microsoft Pinyin (zh-Hans-CN) |
| Terminal font |
Hack Nerd Font |
Description
When typing Chinese characters in the OpenCode TUI chat input using a Chinese IME (Input Method Editor), all composed characters are displayed as underscores _______ instead of the actual Chinese characters.
The IME candidate window appears correctly, and selecting a candidate should input the Chinese character, but the TUI renders it as underscores.
Steps to Reproduce
- Launch
opencode in Windows Terminal
- Switch to Chinese input method (Microsoft Pinyin)
- Type pinyin in the chat input (e.g.,
nihao)
- The input field shows
_______ instead of the composition text
- Select a candidate from the IME window
- The confirmed character also appears as underscore or is not displayed
Expected Behavior
- During IME composition: the pinyin text should be visible in the input field
- After IME confirmation: the Chinese character should be displayed correctly
- The input should work seamlessly with Chinese IME, similar to how it works in other TUI applications
Actual Behavior
- All Chinese input (composition and confirmed characters) appears as underscores
_______
- The IME candidate window works correctly
- English input works fine
- The issue affects all Chinese IME operations in the TUI
Diagnostic Information
System code page verification:
Active code page: 65001
ACP: 65001
OEMCP: 65001
Chinese character OUTPUT test (bash tool):
$ echo "中文测试:你好世界"
中文测试:你好世界
Output works correctly — the issue is INPUT only.
VT processing:
HKCU:\Console\VirtualTerminalLevel = 1
HKCU:\Console\%wt%\VirtualTerminalLevel = 1
Related Issues
This appears to be related to:
Root Cause Analysis
The issue appears to be in the TUI's input handling layer. The IME composition events (compositionstart, compositionupdate, compositionend) are not properly handled in the Windows terminal environment. The TUI renders the composition buffer as underscores instead of the actual text.
PR #17013 and #17041 attempted to fix IME composition handling, but the issue persists on Windows.
Additional Context
- The issue is Windows-specific — macOS and Linux may handle IME differently
- The issue affects input only — Chinese character output works correctly
- The issue persists with system code page set to 65001 (UTF-8)
- The issue affects all Chinese IME operations (composition, confirmation, editing)
Workaround
Currently, the only workaround is to:
- Type Chinese text in an external editor (e.g., Notepad, VS Code)
- Copy the text
- Paste it into the OpenCode TUI
This is not ideal for users who primarily work with Chinese input.
Bug Report: Chinese IME input shows underscores in TUI on Windows
Environment
Description
When typing Chinese characters in the OpenCode TUI chat input using a Chinese IME (Input Method Editor), all composed characters are displayed as underscores _______ instead of the actual Chinese characters.
The IME candidate window appears correctly, and selecting a candidate should input the Chinese character, but the TUI renders it as underscores.
Steps to Reproduce
opencodein Windows Terminalnihao)_______instead of the composition textExpected Behavior
Actual Behavior
_______Diagnostic Information
System code page verification:
Chinese character OUTPUT test (bash tool):
Output works correctly — the issue is INPUT only.
VT processing:
Related Issues
This appears to be related to:
Root Cause Analysis
The issue appears to be in the TUI's input handling layer. The IME composition events (
compositionstart,compositionupdate,compositionend) are not properly handled in the Windows terminal environment. The TUI renders the composition buffer as underscores instead of the actual text.PR #17013 and #17041 attempted to fix IME composition handling, but the issue persists on Windows.
Additional Context
Workaround
Currently, the only workaround is to:
This is not ideal for users who primarily work with Chinese input.