From 238563af4d4e78e57e5bd5596dc463a5ac4ebe04 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 10 Feb 2024 09:26:46 -0500 Subject: [PATCH] Add explicit encoding to read_text. Closes #561 --- src/towncrier/build.py | 4 +++- src/towncrier/newsfragments/561.bugfix.rst | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 src/towncrier/newsfragments/561.bugfix.rst diff --git a/src/towncrier/build.py b/src/towncrier/build.py index 3a07bae1..f8e4175e 100644 --- a/src/towncrier/build.py +++ b/src/towncrier/build.py @@ -166,7 +166,9 @@ def __main( click.echo("Loading template...", err=to_err) if isinstance(config.template, tuple): template = ( - resources.files(config.template[0]).joinpath(config.template[1]).read_text() + resources.files(config.template[0]) + .joinpath(config.template[1]) + .read_text(encoding="utf-8") ) else: with open(config.template, encoding="utf-8") as tmpl: diff --git a/src/towncrier/newsfragments/561.bugfix.rst b/src/towncrier/newsfragments/561.bugfix.rst new file mode 100644 index 00000000..a70ef55f --- /dev/null +++ b/src/towncrier/newsfragments/561.bugfix.rst @@ -0,0 +1 @@ +Add explicit encoding to read_text. \ No newline at end of file