From e9d152560dcd807fa76390942a0e38b362e0ec89 Mon Sep 17 00:00:00 2001 From: mjfernez Date: Wed, 9 Jun 2021 18:56:20 -0400 Subject: Force UTF-8 encoding --- server.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'server.py') diff --git a/server.py b/server.py index 692fe8c..e2e93f0 100644 --- a/server.py +++ b/server.py @@ -119,8 +119,8 @@ def render_file(path): ) if os.path.isfile(abs_path): if abs_path.endswith('.html'): - with open(abs_path) as f: - content = f.read() + with open(abs_path, 'rb') as f: + content = f.read().decode("UTF-8") return render_template_string(CONTENT_BLOCK.replace('$', content), **context) elif abs_path.endswith('.html!'): return render_template("site/" + path, **context) -- cgit v1.2.3