Skip to content

Character encoding of stdin/stdout is platform-dependent, leading to Unicode corruption #199

@rnortman

Description

@rnortman

Describe the bug
Character encoding of stdin/stdout on Windows is not UTF-8. (It will depend on the Windows locale, but usually CP437 or CP1252.) This breaks JSON, which requires proper Unicode. The Windows Claude Desktop application at least sense UTF-8 encoded data.

To Reproduce
Steps to reproduce the behavior:

  1. Run Claude Desktop on Windows with an MCP server
  2. Send something with an emoji
  3. Observe corruption

Expected behavior
Unicode characters are not corrupted. (MCP clients/servers should be using UTF-8; see additional context below.)

Screenshots
N/A

Desktop (please complete the following information):

  • OS: Windows 11
  • Browser: None (Claude Desktop)
  • Version: ???

Smartphone (please complete the following information):
N/A

Additional context

The JSON spec requires UTF-8, UTF-16, or UTF-32 encoding, so the default behavior on Windows is out of spec. The MCP protocol spec does not specify encoding and has no handshake to establish it, so this leaves some ambiguity, but I think UTF-8 is by far the most reasonable default in the modern era.

I have put up a PR with a fix: #198

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions