mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-09-19 06:54:25 +02:00
JSON output no longer escapes non-ASCII characters, new --ascii option
sqlite-utils query/rows/search/tables/views/triggers/indexes/memory now output JSON with ensure_ascii=False, so unicode text like 日本語 is emitted directly instead of as \uXXXX escape sequences. This matches how values were already stored on insert (jsonify_if_needed) and how CSV/TSV output already behaved. A new --ascii flag on all of those commands restores the previous escaped output, for systems that cannot handle UTF-8. Also applies ensure_ascii=False to the convert --multi --dry-run preview (matching what would actually be stored) and to plugins listing output. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JaHan1NhaTRAxJ9LQtSLf9
This commit is contained in:
parent
d516e58543
commit
684dd2bf2b
5 changed files with 114 additions and 6 deletions
|
|
@ -215,6 +215,25 @@ def test_convert_multi_dryrun(test_db_and_path):
|
|||
)
|
||||
|
||||
|
||||
def test_convert_multi_dryrun_unicode_not_escaped(test_db_and_path):
|
||||
db_path = test_db_and_path[1]
|
||||
result = CliRunner().invoke(
|
||||
cli.cli,
|
||||
[
|
||||
"convert",
|
||||
db_path,
|
||||
"example",
|
||||
"dt",
|
||||
"{'text': 'Japanese 日本語'}",
|
||||
"--dry-run",
|
||||
"--multi",
|
||||
],
|
||||
)
|
||||
assert result.exit_code == 0
|
||||
# Preview should match what jsonify_if_needed() would actually store
|
||||
assert '{"text": "Japanese 日本語"}' in result.output
|
||||
|
||||
|
||||
@pytest.mark.parametrize("drop", (True, False))
|
||||
def test_convert_output_column(test_db_and_path, drop):
|
||||
db, db_path = test_db_and_path
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue