Skip to content

cli: output JSON without escaping non-ASCII characters#741

Open
c-tonneslan wants to merge 1 commit into
simonw:mainfrom
c-tonneslan:fix/json-utf8-output
Open

cli: output JSON without escaping non-ASCII characters#741
c-tonneslan wants to merge 1 commit into
simonw:mainfrom
c-tonneslan:fix/json-utf8-output

Conversation

@c-tonneslan
Copy link
Copy Markdown

@c-tonneslan c-tonneslan commented May 18, 2026

Closes #625.

json.dumps defaults to ensure_ascii=True, so output_rows emitted 日本語 instead of 日本語 for Japanese rows. The CSV path already shows the characters verbatim — the JSON path should too. Pass ensure_ascii=False so the bytes match what the CSV output (and the database itself) holds.


📚 Documentation preview 📚: https://sqlite-utils--741.org.readthedocs.build/en/741/

Closes simonw#625.

json.dumps defaults to ensure_ascii=True, so output_rows emitted
'\u65e5\u672c\u8a9e' instead of '日本語' for Japanese.
The CSV path already shows the characters verbatim - the JSON path
should too. Pass ensure_ascii=False so the bytes match what the CSV
output (and the database itself) holds.

Signed-off-by: Charlie Tonneslan <cst0520@gmail.com>
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.

Doublebyte content is unicode-escaped in JSON output

1 participant