Skip to content

Unicode Error using ISO-8859-1 as default_charset #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
anderser opened this issue May 29, 2009 · 2 comments
Closed

Unicode Error using ISO-8859-1 as default_charset #15

anderser opened this issue May 29, 2009 · 2 comments
Labels

Comments

@anderser
Copy link

Seems the rendering of the toolbar crashes when default_charset="iso-8859-1" in settings.py.

Traceback (most recent call last):

  File "c:\Python25\Lib\site-packages\django\core\servers\basehttp.py", line 278, in run
    self.result = application(self.environ, self.start_response)

  File "c:\Python25\Lib\site-packages\django\core\servers\basehttp.py", line 635, in __call__
    return self.application(environ, start_response)

  File "c:\Python25\lib\site-packages\django\core\handlers\wsgi.py", line 245, in __call__
    response = middleware_method(request, response)

  File "c:\Python25\lib\site-packages\django_debug_toolbar-0.7.0-py2.5.egg\debug_toolbar\middleware.py", line 93, in process_response
    response.content = replace_insensitive(smart_unicode(response.content), u'</body>', smart_unicode(self.debug_toolbar.render_toolbar() + u'</body>'))

  File "c:\Python25\lib\site-packages\django\utils\encoding.py", line 42, in smart_unicode
    return force_unicode(s, encoding, strings_only, errors)

  File "c:\Python25\lib\site-packages\django\utils\encoding.py", line 77, in force_unicode
    raise DjangoUnicodeDecodeError(s, *e.args)

DjangoUnicodeDecodeError: 'utf8' codec can't decode bytes in position 4432-4434: invalid data. You passed in '\n\n\n\n\n\n<!DOblablablab (my iso-8859-1 encoded page with lots of nordic characters like æøå)

The debug toolbar works if default_charset is set to "utf-8", but that is not an option for me...

@revolunet
Copy link

theres a quick fix in #228

@aaugustin
Copy link
Contributor

Better late than never!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants