dialog: Open template file as utf8 encoded

To avoid UnicodeDecodeError's when opening files tell Python that we
want to open the file as a utf8 encoded file.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
pull/1958/head
Alistair Francis 2019-01-17 11:44:49 -08:00
parent ce37c7861b
commit 4c140c3cfe
1 changed files with 1 additions and 1 deletions

View File

@ -43,7 +43,7 @@ class MustacheDialogRenderer:
template_name (str): a unique identifier for a group of templates
filename (str): a fully qualified filename of a mustache template.
"""
with open(filename, 'r') as f:
with open(filename, 'r', encoding='utf8') as f:
for line in f:
template_text = line.strip()
# Skip all lines starting with '#' and all empty lines