StartPage - handle should always return unicode

This commit is contained in:
lorenz
2018-10-05 07:04:35 +02:00
committed by wmayer
parent c159f9abad
commit 795e261be6

View File

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