From 869e967e86cef2adc1ac2414a8ad550d2f442bfe Mon Sep 17 00:00:00 2001 From: gauthiier Date: Fri, 10 Dec 2021 13:38:02 +0100 Subject: [PATCH] pull.py utf-8 fixes --- pppadump/commands/pull.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pppadump/commands/pull.py b/pppadump/commands/pull.py index 59a7705..f3e4c96 100644 --- a/pppadump/commands/pull.py +++ b/pppadump/commands/pull.py @@ -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"]