Fix crash on error pages with URLs not encodable in latin1.

It seems PyQt does some implicit latin1 encoding when we set the content
attribute to a string rather than a bytes object.

Fixes #127.
This commit is contained in:
Florian Bruhin 2014-10-02 06:28:49 +02:00
parent 00949db2cf
commit e4e8d16ee8

View File

@ -116,8 +116,10 @@ class BrowserPage(QWebPage):
info.domain, info.error))
title = "Error loading page: {}".format(urlstr)
template = jinja.env.get_template('error.html')
errpage.content = template.render( # pylint: disable=maybe-no-member
html = template.render( # pylint: disable=maybe-no-member
title=title, url=urlstr, error=info.errorString, icon='')
errpage.content = html.encode('utf-8')
errpage.encoding = 'utf-8'
return True
def _handle_multiple_files(self, opt, files):