Pasting Thai/multibyte UTF-8 into prompt input strips bytes 0x80–0x9F (mojibake, unrecoverable)

Resolved 💬 2 comments Opened Jun 26, 2026 by DataBi1 Closed Jun 30, 2026

Summary

Pasting Thai (or any multibyte UTF-8 text containing bytes in the C1 control range 0x80–0x9F) into the Claude Code prompt input silently strips those bytes, producing mojibake. Because the bytes are dropped (not merely re-encoded), the original text is unrecoverable.

Typing the same Thai text directly via IME works perfectly — the corruption happens only on paste.

Environment

  • Claude Code: 2.1.195 (native install, ~/.local/bin/claude)
  • OS: macOS (Darwin 25.5.0)
  • Terminal: VS Code integrated terminal (TERM_PROGRAM=vscode, TERM=xterm-256color)
  • Locale: LANG=C.UTF-8

Steps to Reproduce

  1. Have any Thai text rendered in the terminal, e.g. ทดสอบภาษาไทย 123
  2. Select it and copy
  3. Paste it into the Claude Code prompt input box

Expected

Pasted text matches the source: ทดสอบภาษาไทย 123

Actual

Mojibake with characters dropped, e.g. à¸à¸à¸ªà¸­à¸à¸ าษาà¹à¸à¸¢ 123

The text is interpreted as Latin-1 AND the C1 control bytes (0x80–0x9F) — which occur frequently in Thai UTF-8 sequences (e.g. ท = E0 B8 97, where 0x97 is a C1 control) — are stripped. Round-trip recovery via .encode('latin-1').decode('utf-8') fails because the bytes are gone, not preserved.

Impact

Any user working in Thai (and likely other scripts whose UTF-8 second/third bytes land in 0x80–0x9F, e.g. many CJK/Cyrillic/Arabic ranges) cannot paste text into the prompt without irreversible corruption. Reported by the user as a regression that appeared after upgrading to a recent version.

Notes

  • Pasting into a VS Code editor file (UTF-8) is clean — confirms the issue is in Claude Code's input/paste handling, not the OS clipboard or terminal.
  • Likely a paste-path filter that drops control characters without preserving multibyte UTF-8 sequences (bracketed-paste sanitization treating raw bytes individually instead of decoding UTF-8 first).

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗