From 795e261be67a3f1b1f86a47ecd51d5b8b338682d Mon Sep 17 00:00:00 2001 From: lorenz Date: Fri, 5 Oct 2018 07:04:35 +0200 Subject: [PATCH] StartPage - handle should always return unicode --- src/Mod/Start/StartPage/StartPage.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Mod/Start/StartPage/StartPage.py b/src/Mod/Start/StartPage/StartPage.py index 302ddaf250..90e7c98168 100644 --- a/src/Mod/Start/StartPage/StartPage.py +++ b/src/Mod/Start/StartPage/StartPage.py @@ -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