Opened 15 years ago

Closed 15 years ago

Last modified 13 years ago

#12774 closed (duplicate)

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

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 (last modified by Karen Tracey)

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__
   self['Location'] = 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 (2)

comment:1 by Alex Gaynor, 15 years ago

Triage Stage: UnreviewedAccepted

comment:2 by Karen Tracey, 15 years ago

Description: modified (diff)
Resolution: duplicate
Status: newclosed

Reformatted description. This is #11456 exactly. Please search and use preview.

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