#27895: Test Client fails to decode json response with unicode characters
---------------------------------------------+------------------------
               Reporter:  Aniruddha Maru     |          Owner:  nobody
                   Type:  Bug                |         Status:  new
              Component:  Testing framework  |        Version:  1.10
               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                  |
---------------------------------------------+------------------------
 Since `application/json` response ought to be encoded with `utf-8` charset
 per spec [https://tools.ietf.org/html/rfc7159#page-11 RFC 7159], they
 should be decoded as such.

 The problematic line is
 [https://github.com/django/django/blob/master/django/test/client.py#L682
 here]:
 {{{#!python
             response._json = json.loads(response.content.decode(),
 **extra)
 }}}

 Which ought to be changed to:

 {{{#!python
             response._json = json.loads(response.content.decode('utf-8'),
 **extra)
 }}}

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

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/049.15421c7df7b7d20e2de2bcf782f7017b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to