#33567: Builtin csrf_failure() view uses wrong charset
-------------------------+------------------------------------
     Reporter:  MrVichr  |                    Owner:  nobody
         Type:  Bug      |                   Status:  new
    Component:  CSRF     |                  Version:  4.0
     Severity:  Normal   |               Resolution:
     Keywords:  csrf     |             Triage Stage:  Accepted
    Has patch:  1        |      Needs documentation:  0
  Needs tests:  0        |  Patch needs improvement:  0
Easy pickings:  1        |                    UI/UX:  0
-------------------------+------------------------------------
Changes (by Carlton Gibson):

 * status:  closed => new
 * has_patch:  0 => 1
 * resolution:  needsinfo =>
 * stage:  Unreviewed => Accepted


Comment:

 Good link!

 > It is very important to always label Web documents explicitly. HTTP 1.1
 says that the default charset is ISO-8859-1. ...

 So we can presume the doc is interpreted as ISO-8859-1, rather than UTF-8,
 and so an error (although exact example...)

 {{{
 >>> r = HttpResponse("Hello 🎉", content_type="text/html")
 >>> r.charset
 'utf-8'
 >>> r.serialize_headers()
 b'Content-Type: text/html'

 >>> r = HttpResponse("Hello 🎉")
 >>> r.serialize_headers()
 b'Content-Type: text/html; charset=utf-8'
 }}}

 Claude's, of removing the half-specified `content_type` automatically
 picks up MrVichr's idea to add the explicit `charset`.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33567#comment:6>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107017f6df7c58a-f4fc51b1-f279-42ca-915a-d6ca23b1f564-000000%40eu-central-1.amazonses.com.

Reply via email to