diff --git a/templatehelper.py b/templatehelper.py index 70ba9bc..e62dfd7 100644 --- a/templatehelper.py +++ b/templatehelper.py @@ -20,6 +20,7 @@ # pylint: disable=unused-import import urllib from datetime import datetime, timezone, tzinfo +import locale # pylint: disable=unused-import import markdown @@ -29,7 +30,7 @@ # pylint: disable=invalid-name config = None -with open("../config.yaml", encoding='utf-8') as file: +with open("../config.yaml", encoding=locale.getencoding()) as file: config = yaml.load(file, Loader=yaml.SafeLoader) @@ -81,7 +82,7 @@ def listdir(path): """ ignorelist = ['index', 'index.md', '*.scmsfasicon', '*.scmstarget'] if os.path.exists(os.path.join(pathprefix, path, '.scmsignore')): - with open(os.path.join(pathprefix, path, '.scmsignore'), encoding='utf-8') as scsmignore: + with open(os.path.join(pathprefix, path, '.scmsignore'), encoding=locale.getencoding()) as scsmignore: ignorelist.extend([line.strip('\n') for line in scsmignore.readlines()]) dirlist = [ os.path.basename(f) @@ -112,7 +113,7 @@ def listchildren(path): """ ignorelist = ['index', 'index.md', '*.scmsfasicon', '*.scmstarget'] if os.path.exists(os.path.join(pathprefix, path, '.scmsignore')): - with open(os.path.join(pathprefix, path, '.scmsignore'), encoding='utf-8') as scmsignore: + with open(os.path.join(pathprefix, path, '.scmsignore'), encoding=locale.getencoding()) as scmsignore: ignorelist.extend([line.strip('\n') for line in scmsignore.readlines()]) dirlist = [ [os.path.basename(f), os.path.basename(f)] @@ -120,7 +121,7 @@ def listchildren(path): if regex.match('^(?!\\.).*(?