Skip to content

fix: add ensure_ascii=False to json.dumps for correct Unicode output #639

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

KatHaruto
Copy link

Set ensure_ascii=False in json.dumps(...) to allow proper Unicode character output (e.g., Japanese).

Without this, non-ASCII characters are escaped (e.g., 日本語 → \u65e5\u672c\u8a9e), which makes logs or exports harder to read.

@KatHaruto KatHaruto force-pushed the fix/enable-unicode-json-output branch from 96a1aec to 3b295e4 Compare May 2, 2025 08:28
@seratch
Copy link
Member

seratch commented May 2, 2025

Thanks for the suggestion! You’re absolutely right. Non-English text in debug logs isn’t very developer-friendly at the moment. Generally speaking, as long as all input text data is UTF-8 encoded, this shouldn’t introduce any issues. In particular, the changes to the debug logging should be safe.

That said, the changes in the following files could potentially affect behavior (though I think it’s unlikely). Still, it would be good to test with a few patterns just to be sure:

  • src/agents/models/chatcmpl_converter.py
  • src/agents/mcp/util.py

Also, the CI tests detect an issue with older Python versions. Could you resolve it?

@seratch seratch requested review from seratch and rm-openai May 2, 2025 12:52
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.

2 participants