Pylons/pyramid_debugtoolbar — Issue #44: URLs with special characters
Author: asaladin
Created: 2011-10-29 17:07:21+00:00
State: open

I have a pyramid application which needs to deal with special characters in urls (like é è).

I had this exception when trying to visit this link:
http://localhost:6543/wiki/Cr%C3%A9er_un_compte (copy/paste from google chrome)
or maybe
http://localhost:6543/wiki/Créer_un_compte (as it looks like in the chrome url bar without copy/paste).

The traceback is at the end of this report. There is no error (the views returns the desired output) after disabling the debugtoolbar.

```
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 53316)
Traceback (most recent call last):
File "/home/adrien/virtualenvs/pyramid1_2/lib/python2.6/site-packages/Paste-1.7.5.1-py2.6.egg/paste/httpserver.py", line 1068, in process_request_in_thread
self.finish_request(request, client_address)
File "/usr/lib/python2.6/SocketServer.py", line 322, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python2.6/SocketServer.py", line 617, in __init__
self.handle()
File "/home/adrien/virtualenvs/pyramid1_2/lib/python2.6/site-packages/Paste-1.7.5.1-py2.6.egg/paste/httpserver.py", line 442, in handle
BaseHTTPRequestHandler.handle(self)
File "/usr/lib/python2.6/BaseHTTPServer.py", line 329, in handle
self.handle_one_request()
File "/home/adrien/virtualenvs/pyramid1_2/lib/python2.6/site-packages/Paste-1.7.5.1-py2.6.egg/paste/httpserver.py", line 437, in handle_one_request
self.wsgi_execute()
File "/home/adrien/virtualenvs/pyramid1_2/lib/python2.6/site-packages/Paste-1.7.5.1-py2.6.egg/paste/httpserver.py", line 287, in wsgi_execute
self.wsgi_start_response)
File "/home/adrien/virtualenvs/pyramid1_2/lib/python2.6/site-packages/pyramid-1.2-py2.6.egg/pyramid/router.py", line 176, in __call__
response = self.handle_request(request)
File "/home/adrien/virtualenvs/pyramid1_2/lib/python2.6/site-packages/pyramid_debugtoolbar-0.9.3-py2.6.egg/pyramid_debugtoolbar/toolbar.py", line 150, in toolbar_tween
toolbar.process_response(response)
File "/home/adrien/virtualenvs/pyramid1_2/lib/python2.6/site-packages/pyramid_debugtoolbar-0.9.3-py2.6.egg/pyramid_debugtoolbar/toolbar.py", line 50, in process_response
vars, request=request)
File "/home/adrien/virtualenvs/pyramid1_2/lib/python2.6/site-packages/pyramid-1.2-py2.6.egg/pyramid/renderers.py", line 69, in render
return helper.render(value, None, request=request)
File "/home/adrien/virtualenvs/pyramid1_2/lib/python2.6/site-packages/pyramid-1.2-py2.6.egg/pyramid/renderers.py", line 418, in render
result = renderer(value, system_values)
File "/home/adrien/virtualenvs/pyramid1_2/lib/python2.6/site-packages/pyramid_jinja2-1.1-py2.6.egg/pyramid_jinja2/__init__.py", line 277, in __call__
return self.template.render(system)
File "/home/adrien/virtualenvs/pyramid1_2/lib/python2.6/site-packages/Jinja2-2.6-py2.6.egg/jinja2/environment.py", line 894, in render
return self.environment.handle_exception(exc_info, True)
File "/home/adrien/virtualenvs/pyramid1_2/lib/python2.6/site-packages/pyramid_debugtoolbar-0.9.3-py2.6.egg/pyramid_debugtoolbar/templates/toolbar.jinja2", line 62, in top-level template code
{{ panel.content()|safe }}
File "/home/adrien/virtualenvs/pyramid1_2/lib/python2.6/site-packages/pyramid_debugtoolbar-0.9.3-py2.6.egg/pyramid_debugtoolbar/panels/headers.py", line 54, in content
vars, self.request)
File "/home/adrien/virtualenvs/pyramid1_2/lib/python2.6/site-packages/pyramid_debugtoolbar-0.9.3-py2.6.egg/pyramid_debugtoolbar/panels/__init__.py", line 24, in render
return render(template_name, vars, request=request)
File "/home/adrien/virtualenvs/pyramid1_2/lib/python2.6/site-packages/pyramid-1.2-py2.6.egg/pyramid/renderers.py", line 69, in render
return helper.render(value, None, request=request)
File "/home/adrien/virtualenvs/pyramid1_2/lib/python2.6/site-packages/pyramid-1.2-py2.6.egg/pyramid/renderers.py", line 418, in render
result = renderer(value, system_values)
File "/home/adrien/virtualenvs/pyramid1_2/lib/python2.6/site-packages/pyramid_jinja2-1.1-py2.6.egg/pyramid_jinja2/__init__.py", line 277, in __call__
return self.template.render(system)
File "/home/adrien/virtualenvs/pyramid1_2/lib/python2.6/site-packages/Jinja2-2.6-py2.6.egg/jinja2/environment.py", line 894, in render
return self.environment.handle_exception(exc_info, True)
File "/home/adrien/virtualenvs/pyramid1_2/lib/python2.6/site-packages/pyramid_debugtoolbar-0.9.3-py2.6.egg/pyramid_debugtoolbar/panels/templates/headers.jinja2", line 13, in top-level template code
{{ value|escape }}
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 8: ordinal not in range(128)
----------------------------------------
```