Japanese (UTF-8) text file attachments are garbled in chat, but read correctly via the Read tool (path-based)
Environment: Claude Code, VS Code extension, macOS
Description:
When a UTF-8-encoded text file containing Japanese text is uploaded as a chat attachment, its content appears garbled — consistent with UTF-8 bytes being misinterpreted as Latin-1/Windows-1252. The exact same file, when read via the Read tool using its full file path, displays correctly.
Steps to reproduce:
- Create a UTF-8 text file with Japanese content, e.g.:
````
これはテストです。
文字化けの再現確認用サンプルです😀
タイムスタンプ:2026-08-19 12:00
- Attach/upload this file directly in the chat.
- Observe the rendered content — it is garbled:
````
ããã¯ãã¹ãã§ãã
æååãã®åç¾ç¢ºèªç¨ãµã³ãã«ã§ãð
ã¿ã¤ã ã¹ã¿ã³ãï¼2026-08-19 12:00
- Instead, ask Claude to read the same file via its full path (e.g.,
/Users/xxx/Downloads/test.txt). - Observe that the content now displays correctly (matching the original).
Expected: Chat-attached UTF-8 text files should display the same correct content as path-based Read access.
Actual: Chat-attached file content is garbled; path-based Read access is correct.
Additional notes: Also reproduced with a real-world UTF-8 text file (Discord chat log export, ~1500 lines with Japanese text and emoji) — same garbling pattern when attached, correct when read via path.