Issue #13 resolved

redirect urls should be encoded to ascii

Anonymous created an issue

This problem showed up for me with mod_wsgi on apache. It wasn't a problem for Django's built-in dev server.

If a URL contains non-ascii characters, then the part of localeurl's middleware that sends redirects, is sending the URL string as-is, which results in a 'Location' header with non-ascii characters in it.

I solved this by adding this to middleware.py: {{{

!python

from django.utils.encoding import iri_to_uri

...

        return HttpResponsePermanentRedirect(iri_to_uri(locale_path))

... }}}

I don't see a place to upload a patch, so I've just pasted the above.

Comments (1)

  1. Log in to comment