pull.py utf-8 fixes

This commit is contained in:
gauthiier 2021-12-10 13:38:02 +01:00
parent 5280ad2f5e
commit 869e967e86

View File

@ -214,7 +214,7 @@ def main (args):
if args.all or args.text:
ver["path"] = p+raw_ext
ver["url"] = quote(ver["path"])
with open(ver["path"], "w") as f:
with open(ver["path"], "w", encoding="utf-8") as f:
f.write(text)
# once the content is settled, compute a hash
# and link it in the metadata!
@ -262,7 +262,7 @@ def main (args):
html5tidy(doc, indent=True, title=padid, scripts=args.script, links=links, viewport_meta="width=device-width,initial-scale=1")
with open(ver["path"], "w") as f:
# f.write(html.encode("utf-8"))
print(ET.tostring(doc, method="html", encoding="unicode"), file=f)
print(ET.tostring(doc, method="html", encoding="utf-8"), file=f)
except TypeError:
# Malformed / incomplete response, record the message (such as "internal error") in the metadata and write NO file!
ver["message"] = html["message"]