Changes between Initial Version and Version 1 of Ticket #19468, comment 14


Ignore:
Timestamp:
Dec 17, 2012, 7:27:15 AM (12 years ago)
Author:
Aymeric Augustin

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #19468, comment 14

    initial v1  
    33> Django will still encode the URL's in UTF-8, so the decoding will probably fail.
    44
    5 The most likely failure mode is a full latin-1 website where URLs aren't URL-encoded. Then the behavior described above in "2) When an URL contains non-ASCII characters..." will kick in.
     5That's a good point that I had missed until now. The `reverse` function (and, as a consequence, the `{% url %}` tag) use `django.utils.encoding.iri_to_uri`, which is hardcoded to use UTF-8: it calls force_bytes without specifying a different encoding.
    66 
    77> `settings.DEFAULT_CHARSET` is really about response encoding, not much else (see #4380).
    88
    99I beg to differ. `settings.DEFAULT_CHARSET` is both about request and response encoding. It is used to decode GET and POST data in requests.
     10
     11----
     12
     13To sum up:
     14- `DEFAULT_CHARSET` applies to the request and response bodies
     15- it isn't clear whether it's intended to apply to anything else
     16- if we use it to decode URLs, we must fix `iri_to_uri` accordingly
     17- if we default to utf-8 to decode URLs, we're making it impossible to use reliably any other charset
Back to Top