diff --git a/src/Mod/Start/StartPage/StartPage.py b/src/Mod/Start/StartPage/StartPage.py index 4951d960bf..a48ea7354e 100644 --- a/src/Mod/Start/StartPage/StartPage.py +++ b/src/Mod/Start/StartPage/StartPage.py @@ -32,6 +32,7 @@ import zipfile import re import FreeCAD import FreeCADGui +import codecs import urllib.parse from . import TranslationTexts from PySide import QtCore, QtGui @@ -424,7 +425,7 @@ def handle(): "", '" ) else: - with open(path, "r") as f: + with codecs.open(path, encoding='utf-8') as f: ALTCSS = f.read() HTML = HTML.replace( "", '" @@ -789,9 +790,13 @@ def exportTestFile(): "Allow to check if everything is Ok" - f = open(os.path.expanduser("~") + os.sep + "freecad-startpage.html", "w") - f.write(handle()) - f.close() + with codecs.open( + os.path.expanduser("~") + os.sep + "freecad-startpage.html", + encoding="utf-8", + mode="w", + ) as f: + f.write(handle()) + f.close() def postStart(switch_wb=True):