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:
parent
00949db2cf
commit
e4e8d16ee8
@ -116,8 +116,10 @@ class BrowserPage(QWebPage):
|
|||||||
info.domain, info.error))
|
info.domain, info.error))
|
||||||
title = "Error loading page: {}".format(urlstr)
|
title = "Error loading page: {}".format(urlstr)
|
||||||
template = jinja.env.get_template('error.html')
|
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='')
|
title=title, url=urlstr, error=info.errorString, icon='')
|
||||||
|
errpage.content = html.encode('utf-8')
|
||||||
|
errpage.encoding = 'utf-8'
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _handle_multiple_files(self, opt, files):
|
def _handle_multiple_files(self, opt, files):
|
||||||
|
Loading…
Reference in New Issue
Block a user