diff options
author | Magnus Hagander | 2019-10-24 12:50:38 +0000 |
---|---|---|
committer | Magnus Hagander | 2019-10-24 12:50:38 +0000 |
commit | 69379d97ba177fdf545458a912cc4a07d7745363 (patch) | |
tree | 1982e54ffd108604b3ee8f34e05aaca8b5caada8 /tools/deploystatic/deploystatic.py | |
parent | 91788cf63f3e853c0c7c99f8daf2eb085233ab5e (diff) |
Hard-code utf8 as template output encoding
They were already utf8, but when comparing to an existing file we'd
open that file in whatever the default encoding was, which sometimes
could be ascii in a limited environment.
Diffstat (limited to 'tools/deploystatic/deploystatic.py')
-rwxr-xr-x | tools/deploystatic/deploystatic.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/deploystatic/deploystatic.py b/tools/deploystatic/deploystatic.py index d1ea49e3..f5b848c9 100755 --- a/tools/deploystatic/deploystatic.py +++ b/tools/deploystatic/deploystatic.py @@ -204,11 +204,11 @@ def deploy_template(env, template, destfile, context): # Only write the file if it has actually changed if os.path.isfile(destfile): - with open(destfile) as f: + with open(destfile, encoding="utf8") as f: if f.read() == s: return - with open(destfile, 'w') as f: + with open(destfile, 'w', encoding="utf8") as f: f.write(s) |