Skip to content

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

Closed
@anderser

Description

@anderser

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...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions