From 0a1a1e7c30e3c68a395cc91e8f68171295b396a6 Mon Sep 17 00:00:00 2001 From: arielle Date: Sun, 20 Jul 2025 01:21:43 -0400 Subject: [PATCH] fix: force utf-8 for reading test files, check all open() calls. --- screenplain/export/html.py | 7 +------ tests/files_test.py | 2 +- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/screenplain/export/html.py b/screenplain/export/html.py index 81c0f8b..776f6ce 100644 --- a/screenplain/export/html.py +++ b/screenplain/export/html.py @@ -166,11 +166,6 @@ def _tag(self, tag_name, classes=[]): return tag(self.out, tag_name, classes) -def _read_file(filename): - with open(path) as stream: - return stream.read() - - def convert(screenplay, out, css_file=None, bare=False): """Convert the screenplay into HTML, written to the file-like object `out`. @@ -191,7 +186,7 @@ def convert_full(screenplay, out, css_file): written to the file-like object `out`. """ - with open(css_file, 'r') as stream: + with open(css_file, 'r', encoding='utf-8') as stream: css = stream.read() out.write( '\n' diff --git a/tests/files_test.py b/tests/files_test.py index 11949e7..c59a1fb 100644 --- a/tests/files_test.py +++ b/tests/files_test.py @@ -20,7 +20,7 @@ def read_file(path): - with open(path) as stream: + with open(path, encoding="utf-8") as stream: return stream.read()