UTF-8 Display Issue in MCP Tool Results - Mojibake with German Umlauts
Summary
Claude Code incorrectly displays UTF-8 characters in MCP tool results, showing mojibake (garbled text) even when the MCP server returns correctly encoded Unicode escape sequences.
Environment
- Platform: Windows (MSYS_NT-10.0-26200)
- MCP Server: Custom Delphi-based server
Description
When an MCP tool returns German umlauts or other UTF-8 characters, Claude Code's display layer shows mojibake instead of the correct characters, even though the underlying JSON-RPC response contains proper Unicode escape sequences.
Steps to Reproduce
- Set up a custom MCP server that executes Windows commands
- Execute a command with German umlauts:
``json``
{"jsonrpc":"2.0","method":"tools/call","params":{"name":"exec","arguments":{"command":"cmd.exe /c echo Hello from MCP Server äöüÄÜÖß"}},"id":3}
- Observe the tool result display in Claude Code
Expected Behavior
Claude Code should display: äöüÄÜÖß
Actual Behavior
Claude Code displays: äüöÃ"ÃoÃ-
Evidence
Raw JSON-RPC Response (Correct)
{"jsonrpc":"2.0","id":3,"result":{"content":[{"type":"text","text":"{\"stdout\":\"Hello from MCP Server \u00E4\u00F6\u00FC\u00C4\u00DC\u00D6\u00DF\r\n\",\"stderr\":\"\",\"exitCode\":0,\"success\":true}"}]}}
The Unicode escapes are correct:
\u00E4= ä\u00F6= ö\u00FC= ü\u00C4= Ä\u00DC= Ü\u00D6= Ö\u00DF= ß
Displayed in Claude Code (Incorrect)
{"stdout":"äüöÃ\"ÃoÃ-\r\n","stderr":"","exitCode":0,"success":true}
Root Cause Analysis
The mojibake pattern (ä for ä, ü for ü, etc.) indicates that UTF-8 byte sequences are being incorrectly interpreted as Latin-1/Windows-1252 encoding in the display layer.
The conversion chain appears to be:
- ✅ MCP Server → Correct Unicode escapes in JSON
- ✅ JSON parsing → Correct UTF-8 bytes
- ❌ Display layer → Incorrect interpretation as Latin-1 instead of UTF-8
Impact
- Tool results with non-ASCII characters are displayed incorrectly
- Affects international users and any tool that outputs UTF-8 content
- The underlying data is correct, only the display is broken
Workaround
None available for end users. The data is correct in the protocol but cannot be properly viewed.
Additional Notes
This appears to be a display-only issue. The actual data flowing through the MCP protocol is correct, suggesting the bug is specifically in how Claude Code renders tool results to the user interface.
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗