Opened 14 years ago

Last modified 13 years ago

#12774 closed

Flatpages will cause unicodedecodeerror if request url contains non-ascii characters and no trailing slash — at Initial Version

Reported by: a.nesse@… Owned by: nobody
Component: HTTP handling Version: 1.2-alpha
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

If you have flatpages activated, it will choke on a unicodedecodeerror if the requested url contains a non-ascii character and no trailing slash.

Example url:
http://www.example.com/%20%C3%A5

This will trigger this message:

Traceback (most recent call last):

File "/usr/lib/python2.6/dist-packages/django/core/handlers/base.py", line 92, in get_response

response = callback(request, *callback_args, callback_kwargs)

File "/usr/lib/python2.6/dist-packages/django/contrib/flatpages/views.py", line 23, in flatpage

return HttpResponseRedirect("%s/" % request.path)

File "/usr/lib/python2.6/dist-packages/django/http/init.py", line 407, in init

selfLocation = redirect_to

File "/usr/lib/python2.6/dist-packages/django/http/init.py", line 320, in setitem

header, value = self._convert_to_ascii(header, value)

File "/usr/lib/python2.6/dist-packages/django/http/init.py", line 309, in _convert_to_ascii

value = value.encode('us-ascii')

UnicodeEncodeError: 'ascii' codec can't encode character u'\xe5' in position 3: ordinal not in range(128), HTTP response headers must be in US-ASCII format

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top