Add explicit UTF-8 charset to InputStreamReader in StdioServerTransportProvider by xxxxxxjun · Pull Request #826 · modelcontextprotocol/java-sdk
Verifies that multi-byte UTF-8 characters (Korean, emoji, accented Latin, Japanese) are correctly preserved through the STDIO inbound processing pipeline.
The test passes regardless of whether UTF-8 is explicitly specified, because the test environment default charset is already UTF-8.
Spawns a child JVM with -Dfile.encoding=ISO-8859-1 to simulate a non-UTF-8 default charset environment. The test sends a JSON-RPC message containing multi-byte characters (Korean, Chinese, accented Latin, emoji) through StdioServerTransportProvider and verifies they are preserved. This test fails without the explicit UTF-8 charset fix and passes with it.
…tocol#295 The issue only reports encoding inconsistency in StdioServerTransportProvider. Revert StdioClientTransport to its original state to keep the PR scoped to the reported problem.
xxxxxxjun
changed the title
Specify UTF-8 charset explicitly in STDIO transport InputStreamReader
Add explicit UTF-8 charset to InputStreamReader in StdioServerTransportProvider
chemicL pushed a commit that referenced this pull request
Mar 2, 2026Also add a test simulating a different locale in an isolated process. Resolves #295
xxxxxxjun
deleted the
fix/stdio-encoding-inconsistency
branch
bhsz
mentioned this pull request
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters