Commit c00b87d
Gorre Surya
fix: set UTF-8 charset before reading request body in servlet transports
All three servlet-based server transports called request.getReader()
without first setting the character encoding. Per the Jakarta Servlet
spec, getReader() defaults to ISO-8859-1 when the Content-Type header
has no explicit charset parameter. Since application/json without a
charset is valid per RFC 8259, non-ASCII characters in tool names,
argument values, and notification data were silently corrupted.
The analogous server-side fix was applied to StdioServerTransportProvider
in #826 and to the HTTP response path in #881. This commit completes the
fix by applying request.setCharacterEncoding("UTF-8") before getReader()
in HttpServletStreamableServerTransportProvider,
HttpServletSseServerTransportProvider, and
HttpServletStatelessServerTransport.
Fixes #8801 parent d182338 commit c00b87d
3 files changed
Lines changed: 3 additions & 0 deletions
File tree
- mcp-core/src/main/java/io/modelcontextprotocol/server/transport
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
386 | 386 | | |
387 | 387 | | |
388 | 388 | | |
| 389 | + | |
389 | 390 | | |
390 | 391 | | |
391 | 392 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
| 157 | + | |
157 | 158 | | |
158 | 159 | | |
159 | 160 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
428 | 428 | | |
429 | 429 | | |
430 | 430 | | |
| 431 | + | |
431 | 432 | | |
432 | 433 | | |
433 | 434 | | |
| |||
0 commit comments