Repository navigation
Description
What happened?
When non ASCII encoding occurs, escaping occurs after JSON serialization. These situations occur in streaming messages using the JSON-RPC 1.0, HTTP+JSON 1.0 and HTTP+JSON 0.3 protocols. I used the version of a2a-sdk is 1.0.3.
Related problematic code:
a2a.server.routes.jsonrpc_dispatcher.JsonRpcDispatcher._create_responsea2a.server.routes.rest_dispatcher.RestDispatcher._handle_streaminga2a.compat.v0_3.rest_adapter.REST03Adapter._handle_streaming_request
Look at the JSON message below, the Chinese has been escaped. Although it does not affect functionality, it is very inconvenient to see these escape characters during debugging, and transmitting the escaped sequence as a JSON string takes up more message length.
If necessary, I can submit a PR.
Relevant log output
Taking `JSON-RPC 1.0` as an example.
Agent: 你好!有什么我可以帮助你的吗?😊
Request:
POST http://localhost:8080/a2a/jsonrpc
Content-Type: application/json; charset=utf-8
A2A-Version: 1.0
{
"id": "12113c25-b752-473f-977e-c9ad33cf4f19",
"jsonrpc": "2.0",
"method": "SendStreamingMessage",
"params": {
"message": {
"contextId": "981968b0-f051-4c7a-abb3-1f5d380effec",
"messageId": "120ec73f93024993becf954d03a672bc",
"parts": [
{
"data": {"content": "你好"}
}
],
"role": "ROLE_USER"
}
}
}
Response:
HTTP/1.1 200 OK
date: Mon, 25 May 2026 16:19:49 GMT
server: uvicorn
cache-control: no-store
x-accel-buffering: no
content-type: text/event-stream; charset=utf-8
Transfer-Encoding: chunked
Connection: close
data: {"result": {"task": {"id": "313bd1ca-5056-43f7-bff7-6a8a49be11c3", "contextId": "981968b0-f051-4c7a-abb3-1f5d380effec", "status": {"state": "TASK_STATE_SUBMITTED"}, "history": [{"messageId": "120ec73f93024993becf954d03a672bc", "contextId": "981968b0-f051-4c7a-abb3-1f5d380effec", "taskId": "313bd1ca-5056-43f7-bff7-6a8a49be11c3", "role": "ROLE_USER", "parts": [{"data": {"content": "\u4f60\u597d"}}]}]}}, "id": "12113c25-b752-473f-977e-c9ad33cf4f19", "jsonrpc": "2.0"}
data: {"result": {"statusUpdate": {"taskId": "313bd1ca-5056-43f7-bff7-6a8a49be11c3", "contextId": "981968b0-f051-4c7a-abb3-1f5d380effec", "status": {"state": "TASK_STATE_WORKING", "message": {"messageId": "351bd634-334b-4b4f-b8a6-559d1fa29e6a", "contextId": "981968b0-f051-4c7a-abb3-1f5d380effec", "taskId": "313bd1ca-5056-43f7-bff7-6a8a49be11c3", "role": "ROLE_AGENT", "parts": [{"data": {"interrupt": null, "content": {"name": "", "tool_calls": [], "type": "ai", "text": "\u4f60\u597d\uff01\u6709\u4ec0\u4e48\u6211\u53ef\u4ee5\u5e2e\u52a9\u4f60\u7684\u5417\uff1f\ud83d\ude0a"}}}]}, "timestamp": "2026-05-25T16:19:51.998104Z"}}}, "id": "12113c25-b752-473f-977e-c9ad33cf4f19", "jsonrpc": "2.0"}
data: {"result": {"artifactUpdate": {"taskId": "313bd1ca-5056-43f7-bff7-6a8a49be11c3", "contextId": "981968b0-f051-4c7a-abb3-1f5d380effec", "artifact": {"artifactId": "b687bf5d-6666-40a4-adad-f664dea58a00", "name": "result", "parts": [{"text": "Finished"}]}, "lastChunk": true}}, "id": "12113c25-b752-473f-977e-c9ad33cf4f19", "jsonrpc": "2.0"}
data: {"result": {"statusUpdate": {"taskId": "313bd1ca-5056-43f7-bff7-6a8a49be11c3", "contextId": "981968b0-f051-4c7a-abb3-1f5d380effec", "status": {"state": "TASK_STATE_COMPLETED", "timestamp": "2026-05-25T16:19:51.999409Z"}}}, "id": "12113c25-b752-473f-977e-c9ad33cf4f19", "jsonrpc": "2.0"}Code of Conduct
- I agree to follow this project's Code of Conduct
Activity
sokoliva commentedon May 26, 2026
Hi @dxx,
Thank you for bringing this to our attention!
I replicated the issue and confirmed that we should not escape Non-ASCII characters. In
non-streamingwe use Starlette'sJSONResponse(which usesensure_ascii=False) so escaping non-ASCII characters in streaming was inconsistent behaviour. More importantly, non-Latin scripts should not be treated as second-class.The fix: #1080 is about to be merged.
fix(server): preserve non-ASCII characters in streaming JSON responses (