Skip to content Skip to sidebar Skip to footer

Django Can't Have Quoted Characters In Urls?

I'm following this thread and adopt the code by peppergrower. But when I add the encrypted and quoted characters to the url and try access this url, Django failed with the followin

Solution 1:

There are a few Django tickets relevant to this issue https://code.djangoproject.com/ticket/16541 and https://code.djangoproject.com/ticket/5738. In particular Malcolm's comment on #5738 given in part below:

The problem is that although UTF-8 is strongly recommended as the encoding for non-ASCII data, it's not actually codified in any spec until quite recently (RFC 2396 leaves things wide open, for example). Only in RFC 3986 were things made clear for IRI to URI encoding.

In the interim, systems were deployed that spit out non-UTF-8 encoded URIs.

So I'm going to commit a change that passes back a 400 response for malformed input (non-UTF-8) but also makes it easier to override the request class, so if somebody is dealing with a legacy system, they can subclass WSGIRequestor or ModPythonRequest to handle decoding the URI however they need to.


Post a Comment for "Django Can't Have Quoted Characters In Urls?"