Skip to content

Fix: Add UTF-8 charset to Content-Type header for Chinese tool names#905

Closed
internet-dot wants to merge 1 commit intomodelcontextprotocol:mainfrom
internet-dot:fix/utf-8-chinese-tool-names
Closed

Fix: Add UTF-8 charset to Content-Type header for Chinese tool names#905
internet-dot wants to merge 1 commit intomodelcontextprotocol:mainfrom
internet-dot:fix/utf-8-chinese-tool-names

Conversation

@internet-dot
Copy link
Copy Markdown

When calling tools with Chinese names using HttpClientSseClientTransport or HttpClientStreamableHttpTransport, the JSON body was sent without explicit charset encoding. This caused Chinese characters to be corrupted on the server side because the default encoding wasn't UTF-8.

This fix adds '; charset=UTF-8' to the Content-Type header in both transport classes, ensuring proper encoding of non-ASCII characters.

Fixes #260

When calling tools with Chinese names using HttpClientSseClientTransport
or HttpClientStreamableHttpTransport, the JSON body was sent without
explicit charset encoding. This caused Chinese characters to be corrupted
on the server side because the default encoding wasn't UTF-8.

This fix adds '; charset=UTF-8' to the Content-Type header in both transport
classes, ensuring proper encoding of non-ASCII characters.

Fixes modelcontextprotocol#260
@Kehrlann
Copy link
Copy Markdown
Contributor

Kehrlann commented Apr 8, 2026

Hey @internet-dot ! Thank you for your contribution .There already is an open PR for this, in #850 . I'm closing this one as duplicate.
If #850 is unresponsive, I'll reopen this and ping you.

@Kehrlann Kehrlann closed this Apr 8, 2026
@Kehrlann Kehrlann added the duplicate This issue or pull request already exists label Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

duplicate This issue or pull request already exists

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to call tools with Chinese names using HttpClientSseClientTransport and HttpClientStreamableHttpTransport

2 participants