1
0
Fork 0

hardcode more encodings

This commit is contained in:
Nick Sweeting 2017-07-04 06:26:46 -05:00
parent 881de8adbe
commit 60ffe0b2b4
2 changed files with 4 additions and 4 deletions

View file

@ -126,7 +126,7 @@ def archive_dot_org(out_dir, link, overwrite=False, timeout=60):
print(' Failed: {} {}'.format(e.__class__.__name__, e))
if success:
with open('{}/archive.org.txt'.format(out_dir), 'w') as f:
with open('{}/archive.org.txt'.format(out_dir), 'w', encoding='utf-8') as f:
f.write(saved_url)
chmod_file('archive.org.txt', cwd=out_dir)
@ -215,7 +215,7 @@ def dump_link_info(out_dir, link, update=True):
link_json = derived_link_info(link)
link_json['archived_timstamp'] = str(datetime.now().timestamp()).split('.')[0]
with open(info_file_path, 'w') as link_file:
with open(info_file_path, 'w', encoding='utf-8') as link_file:
link_file.write(json.dumps(
link_json,
indent=4,

View file

@ -8,11 +8,11 @@ from parse import derived_link_info
def dump_index(links, service):
"""create index.html file for a given list of links and service"""
with open(INDEX_TEMPLATE, 'r') as f:
with open(INDEX_TEMPLATE, 'r', encoding='utf-8') as f:
index_html = f.read()
# TODO: refactor this out into index_template.html
with open(INDEX_ROW_TEMPLATE, 'r') as f:
with open(INDEX_ROW_TEMPLATE, 'r', encoding='utf-8') as f:
link_html = f.read()
article_rows = '\n'.join(