Uploading a UTF-8 CSV file via 'Upload from computer' corrupts Japanese text (double-encoding via Latin-1 misinterpretation)
Severity
Low — a workaround exists (see below). Filing mainly so the underlying encoding bug is tracked.
Description
When attaching a UTF-8-encoded CSV file (containing Japanese text) via the "+" → "Upload from computer" button in the Claude Code VSCode extension, the Japanese text is corrupted (mojibake) by the time it reaches the model.
Steps to reproduce
- Prepare a UTF-8 CSV file containing Japanese text locally
- In the Claude Code VSCode extension chat input, click "+" → "Upload from computer"
- Select the file and attach it
- Observe the content the model receives
Expected behavior
The Japanese text should appear correctly, same as reading the file directly from its local path.
Actual behavior
The Japanese text is corrupted. Example:
- Correct:
詳細設計書 - Corrupted:
詳細è¨è¨æ¸
Suspected root cause
The corruption pattern is consistent with a "double-encoding" bug: the original UTF-8 bytes appear to be misinterpreted as Latin-1 (ISO-8859-1) at some point during upload processing, and then re-encoded as UTF-8. This was confirmed empirically — applying content.encode('latin-1').decode('utf-8') to the corrupted text recovers the original correct text.
This suggests the upload path is reading the file as text with an incorrect/default encoding assumption, rather than preserving the raw bytes. Passing the file through as raw bytes (or correctly decoding as UTF-8) should avoid this entirely.
Workaround
Reading the same file directly via its local file path (e.g. asking Claude to read the file at /path/to/file.csv) works correctly and is unaffected by this bug. Only the chat UI's file upload/attachment path is affected.
Environment
- Claude Code (VSCode extension) version 2.1.260 — confirmed this matches the latest version currently published on the VS Code Marketplace
- File format: CSV (UTF-8, containing Japanese text)
- OS: macOS (darwin-arm64)