[Bug] Vietnamese IME input drops characters in terminal (Unikey/ibus-unikey)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
---
Title:
[Bug] Vietnamese IME input drops characters in terminal (Unikey/ibus-unikey)
---
Body:
## Bug Description
When typing Vietnamese using an IME (e.g., Unikey on Windows/macOS, ibus-unikey on Linux),
characters are randomly dropped from the input. The IME uses backspace (0x7F / DEL) to
replace raw keystrokes with composed Vietnamese characters, but Claude Code's input handler
processes the backspaces without inserting the replacement text.
## Steps to Reproduce
- Install a Vietnamese IME (Unikey, ibus-unikey, or similar) (I am using OpenKey app)
- Set input method to Telex or VNI
- Open Claude Code in terminal
- Type any Vietnamese sentence, e.g.:
check dùm tôi các lỗi sau
## Expected Behavior
check dùm tôi các lỗi sau
## Actual Behavior
check d tôi c l sau
Characters like ùm, ác, ỗi are dropped — only the first keystroke survives.
## Root Cause
Vietnamese IMEs compose characters by sending:
- Raw keystrokes (e.g.,
d,u,m) - Multiple DEL/backspace bytes (0x7F) to erase them
- The final composed character (e.g.,
dùm)
Claude Code's input handler processes the DEL bytes (deleting characters from the buffer)
but does not insert the replacement text that follows, causing characters to disappear.
The affected code pattern in cli.js:
```js
if(input.includes("\x7f")) {
// handles backspaces but discards the replacement text
}
Environment
- OS: macOS / Windows / Linux
- IME: Unikey (macOS/Windows), ibus-unikey (Linux)
- Input method: Telex / VNI
- Claude Code version: latest (@anthropic-ai/claude-code)
- Node.js version: (run node --version)
- Terminal: iTerm2 / Terminal.app / Windows Terminal / GNOME Terminal
Workaround
A community patch exists that fixes this by applying both the backspaces and
the replacement text:
https://github.com/manhit96/claude-code-vietnamese-fix
Fix Suggestion
When the input buffer contains DEL bytes (0x7F), the handler should:
- Apply N backspaces to remove N DEL chars
- Insert the remaining characters in the buffer as replacement text
if (input.includes("\x7f")) {
const n = (input.match(/\x7f/g) || []).length;
const replacement = input.replace(/\x7f/g, "");
let state = curState;
for (let i = 0; i < n; i++) state = state.backspace();
for (const c of replacement) state = state.insert(c);
if (!curState.equals(state)) {
if (curState.text !== state.text) updateText(state.text);
updateOffset(state.offset);
}
return;
}
This affects all Vietnamese users of Claude Code (~100M Vietnamese speakers).
What Should Happen?
When typing Vietnamese using an IME (Telex/VNI), the full composed text should appear correctly in the input buffer.
Example: typing "check dùm tôi các lỗi sau" should display exactly:
check dùm tôi các lỗi sau
Error Messages/Logs
Steps to Reproduce
- Install a Vietnamese IME (Unikey on macOS/Windows, or ibus-unikey on Linux)
- Enable Telex or VNI input method
- Open Claude Code in terminal: claude
- Type any Vietnamese sentence using the IME, e.g.: check dùm tôi các lỗi sau
No additional code or files needed — the bug occurs directly in the Claude Code
input prompt.
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
Claude Code v2.1.63
Claude Code Version
Claude Code v2.1.63
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗