Skip to content

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

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

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to call tools with Chinese names using HttpClientSseClientTransport and HttpClientStreamableHttpTransport

1 participant