Ensure that the readme is written in UTF-8.

This patch fixes #1166.

Indeed as stated in the documentation:

> In text mode, if encoding is not specified the encoding used is platform
> dependent: locale.getpreferredencoding(False) is called to get the
> current locale encoding.

That may explain the issue mentionned in #1166.

Docs link:
  * https://docs.python.org/3/library/functions.html#open
This commit is contained in:
funilrys 2020-02-24 18:18:17 +01:00
parent dc51c546be
commit 3abea87f37
No known key found for this signature in database
GPG Key ID: 0D8BFEF5515C00C6

View File

@ -79,7 +79,9 @@ def main():
this_row.update(source) this_row.update(source)
source_rows += t.substitute(this_row) + "\n" source_rows += t.substitute(this_row) + "\n"
with open(os.path.join(data[key]["location"], README_FILENAME), "wt") as out: with open(
os.path.join(data[key]["location"], README_FILENAME), "wt", encoding="utf-8"
) as out:
for line in open(README_TEMPLATE): for line in open(README_TEMPLATE):
line = line.replace( line = line.replace(
"@GEN_DATE@", time.strftime("%B %d %Y", time.gmtime()) "@GEN_DATE@", time.strftime("%B %d %Y", time.gmtime())