Skip to content

Insert from JSON containing strings with non-ascii characters are escaped as unicode for lists, tuples, dicts. #257

Description

@dylan-wu

JSON Test File (test.json):

[
    {
        "id": 123,
        "text": "FR Théâtre"
    },
    {
        "id": 223,
        "text": [
            "FR Théâtre"
        ]
    }
]

Command to import:

sqlite-utils insert test.db text test.json --pk=id

Resulting table view from datasette:

image

Original, db.py line 2225:

        return json.dumps(value, default=repr)

Fix, db.py line 2225:

        return json.dumps(value, default=repr, ensure_ascii=False)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions