fix: add ensure_ascii=False to json.dumps in MCP server#783
Open
OmkarKirpan wants to merge 1 commit intoMemPalace:developfrom
Open
fix: add ensure_ascii=False to json.dumps in MCP server#783OmkarKirpan wants to merge 1 commit intoMemPalace:developfrom
OmkarKirpan wants to merge 1 commit intoMemPalace:developfrom
Conversation
dc8b8db to
17a5d75
Compare
bensig
approved these changes
Apr 15, 2026
Without ensure_ascii=False, json.dumps escapes non-ASCII characters (Chinese, Korean, etc.) which can trigger surrogate encoding errors on Windows and produce unreadable escaped output on all platforms. Adds ensure_ascii=False to all three json.dumps calls in mcp_server.py: - WAL entry logging (line 124) - Tool result serialization (line 1492) - Response output to stdout (line 1525) This matches the pattern already used in hooks_cli.py and config.py. Closes MemPalace#359
17a5d75 to
e6866cf
Compare
Author
|
Hi @bensig, |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #359
json.dumps()in the MCP server escapes non-ASCII characters by default, which causes surrogate encoding errors on Windows when processing Chinese/Korean/CJK content. This crashes the server with:This PR adds
ensure_ascii=Falseto all threejson.dumps()calls inmcp_server.py:This matches the pattern already used in
hooks_cli.py:95andconfig.py:193.Test plan
ruff checkandruff formatclean\uXXXXescapes