Changes between Initial Version and Version 1 of Ticket #19468, comment 14
- Timestamp:
- Dec 17, 2012, 7:27:15 AM (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #19468, comment 14
initial v1 3 3 > Django will still encode the URL's in UTF-8, so the decoding will probably fail. 4 4 5 Th e 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.5 That'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. 6 6 7 7 > `settings.DEFAULT_CHARSET` is really about response encoding, not much else (see #4380). 8 8 9 9 I 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 13 To 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