Opened 8 months ago

Closed 8 months ago

#35436 closed Bug (fixed)

HStoreField shows nonASCII characters as unicode-escaped in the admin

Reported by: Antonis Christofides Owned by: Jae Hyuck Sa
Component: contrib.postgres Version: 4.2
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

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"}

Change History (9)

comment:1 by Simon Charette, 8 months ago

Easy pickings: set
Triage Stage: UnreviewedAccepted

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.

comment:2 by Jae Hyuck Sa , 8 months ago

I'll fix the bug and post the PR :)

comment:3 by Jae Hyuck Sa , 8 months ago

Owner: set to Jae Hyuck Sa
Status: newassigned

comment:4 by Jae Hyuck Sa , 8 months ago

Has patch: set

comment:5 by Simon Charette, 8 months ago

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.

comment:6 by Jae Hyuck Sa , 8 months ago

Last edited 8 months ago by Jae Hyuck Sa (previous) (diff)

in reply to:  5 comment:7 by Jae Hyuck Sa , 8 months ago

Replying to 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.

Thank you :) I'm still lacking a lot, but I'll learn and contribute a lot to Django.

Last edited 8 months ago by Jae Hyuck Sa (previous) (diff)

comment:8 by Sarah Boyce, 8 months ago

Triage Stage: AcceptedReady for checkin

comment:9 by Sarah Boyce <42296566+sarahboyce@…>, 8 months ago

Resolution: fixed
Status: assignedclosed

In f92ac845:

Fixed #35436 -- Fixed displaying Unicode chars in forms.HStoreField.

Note: See TracTickets for help on using tickets.
Back to Top