Pasting multibyte (Japanese/CJK) characters in terminal input causes corruption and truncation
Summary
When pasting long text containing multibyte characters (e.g. Japanese/CJK) into the Claude Code terminal input, the pasted content is corrupted or truncated. Characters are replaced with ? or similar replacement characters, and the text is often cut off mid-paste.
Environment
- Claude Code version: 2.1.87
- OS: macOS (Darwin 25.3.0, arm64)
- Terminal: Cursor integrated terminal (xterm-256color)
- Shell: zsh
Steps to Reproduce
- Open Claude Code in a terminal
- Copy a long string containing Japanese characters (e.g. 日本語のテキストを含む長い文章)
- Paste into the Claude Code input prompt
Expected Behavior
The full text is received correctly, with all multibyte characters preserved.
Actual Behavior
- Some characters are replaced with
?(replacement character) - Text is truncated mid-paste
- The input sometimes freezes and pressing Escape partially exits the frozen state, leaving only part of the pasted text
Root Cause (suspected)
The terminal input processes pasted text character-by-character rather than as a buffered block. For multibyte UTF-8 characters (Japanese = 3 bytes per character), byte sequences get split during processing, resulting in corrupted characters.
Bracketed paste mode (\e[?2004h) would solve this by wrapping paste content in escape sequences, signaling to the input handler to treat the entire paste as literal text rather than individual keystrokes.
Workaround
Currently the only reliable workaround is to use the VS Code extension's GUI input field instead of the terminal.
Request
Please enable bracketed paste mode in the terminal input handler so that:
- Multibyte characters (Japanese, Chinese, Korean, emoji, etc.) are preserved when pasting
- Long pastes are not truncated
- Escape sequences within pasted text are not misinterpreted as control characters
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗