[Django] #35436: HStoreField shows nonASCII characters as unicode-escaped in the admin

23 views
Skip to first unread message

Django

unread,
May 6, 2024, 1:40:55 PMMay 6
to django-...@googlegroups.com
#35436: HStoreField shows nonASCII characters as unicode-escaped in the admin
------------------------------------------------+------------------------
Reporter: Antonis Christofides | Owner: (none)
Type: Bug | Status: new
Component: contrib.postgres | Version: 4.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+------------------------
I have an {{{HStoreField()}}} that has the following contents:


{{{
aira=# select title from aira_maplayer where id=22;
title
------------------------------------------------------
"el"=>"Αρδευτικό δίκτυο", "en"=>"Irrigation network"
(1 row)
}}}

In the Django admin, it shows like this:

{{{
{"el": "\u0391\u03c1\u03b4\u03b5\u03c5\u03c4\u03b9\u03ba\u03cc
\u03b4\u03af\u03ba\u03c4\u03c5\u03bf", "en": "Irrigation network"}
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35436>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 6, 2024, 1:58:30 PMMay 6
to django-...@googlegroups.com
#35436: HStoreField shows nonASCII characters as unicode-escaped in the admin
--------------------------------------+------------------------------------
Reporter: Antonis Christofides | Owner: (none)
Type: Bug | Status: new
Component: contrib.postgres | Version: 4.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Simon Charette):

* easy: 0 => 1
* stage: Unreviewed => Accepted

Comment:

The reason for it is that
`contrib.postgres.forms.HStoreField.prepare_value` doesn't pass
`ensure_ascii=False` to `json.dumps`.

When we fixed it for `JSONField` in #32080 we didn't do the same for
`HStoreField` unfortunately.
--
Ticket URL: <https://code.djangoproject.com/ticket/35436#comment:1>

Django

unread,
May 8, 2024, 9:01:51 AMMay 8
to django-...@googlegroups.com
#35436: HStoreField shows nonASCII characters as unicode-escaped in the admin
--------------------------------------+------------------------------------
Reporter: Antonis Christofides | Owner: (none)
Type: Bug | Status: new
Component: contrib.postgres | Version: 4.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Comment (by Jae Hyuck Sa ):

I'll fix the bug and post the PR :)
--
Ticket URL: <https://code.djangoproject.com/ticket/35436#comment:2>

Django

unread,
May 8, 2024, 9:02:30 AMMay 8
to django-...@googlegroups.com
#35436: HStoreField shows nonASCII characters as unicode-escaped in the admin
-------------------------------------+-------------------------------------
Reporter: Antonis | Owner: Jae Hyuck
Christofides | Sa
Type: Bug | Status: assigned
Component: contrib.postgres | Version: 4.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jae Hyuck Sa ):

* owner: (none) => Jae Hyuck Sa
* status: new => assigned

--
Ticket URL: <https://code.djangoproject.com/ticket/35436#comment:3>

Django

unread,
May 8, 2024, 9:16:26 AMMay 8
to django-...@googlegroups.com
#35436: HStoreField shows nonASCII characters as unicode-escaped in the admin
-------------------------------------+-------------------------------------
Reporter: Antonis | Owner: Jae Hyuck
Christofides | Sa
Type: Bug | Status: assigned
Component: contrib.postgres | Version: 4.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jae Hyuck Sa ):

* has_patch: 0 => 1

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

Django

unread,
May 8, 2024, 10:20:21 AMMay 8
to django-...@googlegroups.com
#35436: HStoreField shows nonASCII characters as unicode-escaped in the admin
-------------------------------------+-------------------------------------
Reporter: Antonis | Owner: Jae Hyuck
Christofides | Sa
Type: Bug | Status: assigned
Component: contrib.postgres | Version: 4.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Simon Charette):

The patch LGTM and is aligned on how we tested `JSONField` in
de81676b51e4dad510ef387c3ae625f9091fe57f. Thank you for taking the time to
submit a patch Jae Hyuck.
--
Ticket URL: <https://code.djangoproject.com/ticket/35436#comment:5>

Django

unread,
May 8, 2024, 10:25:04 AMMay 8
to django-...@googlegroups.com
#35436: HStoreField shows nonASCII characters as unicode-escaped in the admin
-------------------------------------+-------------------------------------
Reporter: Antonis | Owner: Jae Hyuck
Christofides | Sa
Type: Bug | Status: assigned
Component: contrib.postgres | Version: 4.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Jae Hyuck Sa ):

Thank you :) I'm still lacking a lot, but I'll learn and contribute a lot
to Django.
--
Ticket URL: <https://code.djangoproject.com/ticket/35436#comment:6>

Django

unread,
May 8, 2024, 10:25:16 AMMay 8
to django-...@googlegroups.com
#35436: HStoreField shows nonASCII characters as unicode-escaped in the admin
-------------------------------------+-------------------------------------
Reporter: Antonis | Owner: Jae Hyuck
Christofides | Sa
Type: Bug | Status: assigned
Component: contrib.postgres | Version: 4.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Jae Hyuck Sa ):

Replying to [comment:5 Simon Charette]:
> The patch LGTM and is aligned on how we tested `JSONField` in
de81676b51e4dad510ef387c3ae625f9091fe57f. Thank you for taking the time to
submit a patch Jae Hyuck.
--
Ticket URL: <https://code.djangoproject.com/ticket/35436#comment:7>

Django

unread,
May 8, 2024, 10:52:11 AMMay 8
to django-...@googlegroups.com
#35436: HStoreField shows nonASCII characters as unicode-escaped in the admin
-------------------------------------+-------------------------------------
Reporter: Antonis | Owner: Jae Hyuck
Christofides | Sa
Type: Bug | Status: assigned
Component: contrib.postgres | Version: 4.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* stage: Accepted => Ready for checkin

--
Ticket URL: <https://code.djangoproject.com/ticket/35436#comment:8>

Django

unread,
May 10, 2024, 3:42:18 AMMay 10
to django-...@googlegroups.com
#35436: HStoreField shows nonASCII characters as unicode-escaped in the admin
-------------------------------------+-------------------------------------
Reporter: Antonis | Owner: Jae Hyuck
Christofides | Sa
Type: Bug | Status: closed
Component: contrib.postgres | Version: 4.2
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce <42296566+sarahboyce@…>):

* resolution: => fixed
* status: assigned => closed

Comment:

In [changeset:"f92ac845a9c75992120a5b5b219e607c19d3f0aa" f92ac845]:
{{{#!CommitTicketReference repository=""
revision="f92ac845a9c75992120a5b5b219e607c19d3f0aa"
Fixed #35436 -- Fixed displaying Unicode chars in forms.HStoreField.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35436#comment:9>
Reply all
Reply to author
Forward
0 new messages