Re: [Django] #32080: Admin doesn't display Chinese chars in JsonFields.

40 views
Skip to first unread message

Django

unread,
Oct 7, 2020, 11:09:01 AM10/7/20
to django-...@googlegroups.com
#32080: Admin doesn't display Chinese chars in JsonFields.
-------------------------------------+-------------------------------------
Reporter: Qi Zhao | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 3.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by Qi Zhao):

* status: closed => new
* type: New feature => Bug
* resolution: wontfix =>


Comment:

Replying to [comment:2 felixxm]:
> As far as I'm aware, we cannot use `ensure_ascii=False` by default
because it requires `utf8mb4` encoding on MySQL, see #18392. It looks that
you can use a custom `encoder`/`decoder` to make it works without changes
in Django.

No, this function is only used in Django admin's display, so it will not
influence any operation about MySQL writing and reading.
I just tested it using `utf8` encoding on MySQL, and it works perfectly.
In my view, If we save non-ASCII characters in a `JsonField `,such as
emoij,chinese,Japanese....
And when we want to edit it in Django's admin, it is really not good if it
displays in ASCII characters.
In order to fix this,we need to do many extra things...

--
Ticket URL: <https://code.djangoproject.com/ticket/32080#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 7, 2020, 11:18:02 AM10/7/20
to django-...@googlegroups.com
#32080: Admin doesn't display Chinese chars in JsonFields.
-------------------------------------+-------------------------------------
Reporter: Qi Zhao | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 3.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 1
-------------------------------------+-------------------------------------

Comment (by Qi Zhao):

We just need to modify this
line.[https://github.com/django/django/blob/3d4ffd1ff0eb9343ee41de77caf6ae427b6e873c/django/forms/fields.py#L1261]
Then I read the source code of django tests , and It seems that
internationalization is not
considered.(https://github.com/django/django/blob/3d4ffd1ff0eb9343ee41de77caf6ae427b6e873c/tests/forms_tests/field_tests/test_jsonfield.py#L29)

--
Ticket URL: <https://code.djangoproject.com/ticket/32080#comment:4>

Reply all
Reply to author
Forward
0 new messages