Skip to content

Write error bodies as UTF-8 - #344

Merged
anuraaga merged 3 commits into
mainfrom
error-body-utf8
Sep 24, 2026
Merged

anuraaga merged 3 commits into
mainfrom
error-body-utf8

Conversation

@i2y

@i2y i2y commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

json.dumps escapes non-ASCII by default, so an error message came out as "\u91cd\u91cf ..." while message bodies on the same server kept UTF-8. Pass ensure_ascii=False at the library's two json.dumps calls (the unary error body and the end-of-stream frame), matching connect-go, and add a test for each call site.

Fixes #342

i2y and others added 2 commits September 22, 2026 22:56
json.dumps escapes non-ASCII by default, so an error message came out as
"\u91cd\u91cf ..." while message bodies on the same server kept UTF-8.
Pass ensure_ascii=False at the library's two json.dumps calls (the unary
error body and the end-of-stream frame), matching connect-go, and add a
test for each call site.

Fixes #342

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: i2y <6240399+i2y@users.noreply.github.com>
@i2y
i2y marked this pull request as ready for review September 22, 2026 14:54
Signed-off-by: Anuraag Agrawal <anuraaga@gmail.com>

@anuraaga anuraaga left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@anuraaga
anuraaga merged commit 6b3d578 into main Sep 24, 2026
23 checks passed
@anuraaga
anuraaga deleted the error-body-utf8 branch September 24, 2026 04:57
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.

protocol: should error bodies keep non-ASCII as UTF-8, like message bodies?

2 participants