Opened 7 years ago

Closed 7 years ago

Last modified 5 years ago

#12774 closed (duplicate)

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

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: UI/UX:

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 (3)

comment:1 Changed 7 years ago by Alex Gaynor

Triage Stage: UnreviewedAccepted

comment:2 Changed 7 years ago by Karen Tracey

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

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

comment:3 Changed 5 years ago by Jacob

milestone: 1.2

Milestone 1.2 deleted

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