claude-ime
Fix IME input for Claude Code — type Vietnamese, Chinese, Japanese, Korean, and more without garbled characters.
The Problem
Claude Code's terminal doesn't handle IME (Input Method Editor) composition correctly. When you type Vietnamese (Unikey, fcitx), Chinese (Sogou, fcitx), Japanese (Mozc), or Korean (fcitx-hangul), characters get garbled or split across multiple lines because the PTY doesn't respect UTF-8 character boundaries during IME composition.
This breaks your workflow for the 8–10 million developers worldwide who rely on non-Latin input methods.
The Fix
claude-ime wraps Claude Code in a pseudo-terminal (PTY) with proper UTF-8 boundary handling. It:
- Detects IME composition sequences
- Buffers incomplete multibyte characters
- Flushes only when a complete UTF-8 character arrives
- Preserves raw terminal mode for unbroken input/output
Result: seamless IME typing in Claude Code.
Quick Install
Option 1: Cargo (Rust)
Option 2: npm
The npm wrapper auto-downloads the precompiled binary for your platform (darwin/linux/win32, x64/arm64).
Option 3: Manual Binary Download
Download a precompiled binary from GitHub Releases, extract, and add to $PATH:
# Example: macOS ARM64
|
Usage
Wrap Claude Code
This auto-detects the claude binary and wraps it. Now type normally in Vietnamese, Chinese, Japanese, or Korean—no garbling.
Wrap Any Command
Debug Output
Shows PTY setup, IME detection, and UTF-8 boundary crossing events.
Version
How It Works
Your keyboard (IME)
↓
PTY wrapper (claude-ime)
├─ Raw mode + UTF-8 handling
├─ Composition sequence detection
├─ Multibyte character buffering
└─ Bidirectional proxy
↓
Claude Code terminal
- PTY Spawn: Claude Code runs inside a pseudo-terminal, not direct pipes.
- Raw Mode: Input/output bypass line-buffering to preserve IME sequences.
- UTF-8 Boundary Detection: Incoming bytes are scanned for complete UTF-8 characters.
- Composition Proxy: Incomplete sequences (IME composition) are held; complete characters are flushed immediately.
- Bidirectional: Stdin → Claude, Claude output → stdout (transparent pass-through).
Supported IMEs
| Language | IME Engines | Status |
|---|---|---|
| Vietnamese | Unikey, fcitx-unikey, macOS | ✓ |
| Chinese | Sogou, fcitx-pinyin, macOS Pinyin | ✓ |
| Japanese | Mozc, fcitx-mozc, macOS Japanese | ✓ |
| Korean | fcitx-hangul, macOS Korean | ✓ |
Other IMEs (Thai, Lao, Khmer, Arabic, etc.) may work; report issues.
Configuration
Create ~/.config/claude-ime/config.toml:
# Path to the claude binary (auto-detected if not set)
# claude_path = "/usr/local/bin/claude"
# Enable verbose logging (same as --verbose flag)
# verbose = false
# Extra environment variables to pass to the wrapped command
# [extra_env]
# LANG = "en_US.UTF-8"
# LC_ALL = "en_US.UTF-8"
Contributing
Contributions welcome! See CONTRIBUTING.md for:
- Build instructions (
cargo build,cargo test) - Testing with different IMEs
- PR process
- Code style (cargo fmt, cargo clippy)
License
MIT License. See LICENSE for details.
Built by Agenon — AI-operated software.