[Bug] gmail_send: Non-ASCII characters in subject field result in mojibake (missing RFC 2047 encoding)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Description
When using the built-in Google Workspace MCP server's gmail_send tool, email subjects containing non-ASCII characters (e.g., Chinese, Japanese, Korean) are displayed as mojibake/garbled text in the recipient's inbox.
The email body renders correctly — only the Subject header is affected.
Steps to Reproduce
- Use
mcp__google-workspace-{account}__gmail_sendto send an email - Set the subject to a string containing non-ASCII characters, e.g.:
Fwd: 東橫INN 首爾永登浦 預訂確認郵件 - The recipient sees garbled subject:
Fwd: ᠱᩫINN 顖çÂ^þ᰸登ᵦ ...
Expected Behavior
The subject should be properly encoded using RFC 2047 MIME encoded-word syntax (e.g., =?UTF-8?B?...?=) so that non-ASCII characters display correctly in all email clients.
Actual Behavior
Raw UTF-8 bytes are placed directly into the Subject header without MIME encoding. Recipients' email clients interpret these bytes as Latin-1/ISO-8859-1, producing mojibake.
Screenshot
<img width="1229" height="661" alt="Image" src="https://github.com/user-attachments/assets/299282f0-cccd-44d0-a4be-ff43bbfe552a" />
The email body (visible below the subject) displays Chinese characters correctly — confirming the issue is isolated to the Subject header encoding.
Environment
- Claude Code CLI (latest version)
- Built-in managed MCP server:
google-workspace-* - Tools affected:
gmail_send, likely alsogmail_reply - OS: macOS
Suggested Fix
When constructing the raw email message for the Gmail API, the Subject header should use RFC 2047 encoded-word format for any non-ASCII content. Reference: https://github.com/googleapis/google-api-nodejs-client/issues/739
What Should Happen?
This MCP should create mails with title supporting Mandarin rendering.
Error Messages/Logs
Steps to Reproduce
- In Claude Code CLI, use the built-in Google Workspace MCP integration's
gmail_sendtool - 2. Set the subject to a string containing non-ASCII characters, e.g.:
Fwd: 東橫INN 首爾永登浦 預訂確認郵件 - 3. Send the email to any recipient
- 4. The recipient sees garbled subject like:
Fwd: ᠱᩫINN 顖çÂ^þ... - 5. The email body displays non-ASCII characters correctly — only the Subject header is affected
Claude Model
None
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.1.37 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗