StartPage - handle should always return unicode
This commit is contained in:
@@ -472,10 +472,14 @@ def handle():
|
||||
Start.iconbank = iconbank
|
||||
Start.tempfolder = tempfolder
|
||||
|
||||
# encode if necessary
|
||||
# make sure we are always returning unicode
|
||||
# HTML should be a str-object and therefor:
|
||||
# - for py2 HTML is a bytes object and has to be decoded to unicode
|
||||
# - for py3 HTML is already a unicode object and the next 2 lines can be removed
|
||||
# once py2-support is removed.
|
||||
|
||||
if not isinstance(HTML, bytes):
|
||||
HTML = HTML.encode("utf8")
|
||||
if isinstance(HTML, bytes):
|
||||
HTML = HTML.decode("utf8")
|
||||
|
||||
return HTML
|
||||
|
||||
|
||||
Reference in New Issue
Block a user