From d72f7d7b10bee85da01d9a12460bd966bf7bc659 Mon Sep 17 00:00:00 2001 From: Stefan Bethke Date: Tue, 4 Jun 2024 18:58:35 +0200 Subject: [PATCH] properly encode UTF-8 --- hedgedoc-expire.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hedgedoc-expire.py b/hedgedoc-expire.py index b85fa26..b18ace8 100644 --- a/hedgedoc-expire.py +++ b/hedgedoc-expire.py @@ -232,7 +232,7 @@ class HedgedocExpire: '''))) md = MIMEBase('text', 'markdown') md.add_header('Content-Disposition', f'attachment; filename={note["title"]}.md') - md.set_payload(note["content"]) + md.set_payload(note["content"].encode(encoding='utf-8')) msg.attach(md) self.email_sender.send(msg) @@ -243,7 +243,7 @@ class HedgedocExpire: url = self.config.url + '/' + (note["alias"] if note["alias"] is not None else note["shortid"]) print(f'Note "{note["title"]}" ({url}) emailed to {msg["To"]}') except Exception as e: - print(f'Unable to send email to {note["email"]}: {e}', file=sys.stderr) + print(f'Unable to send email to {self.email_from_email_or_profile(note)}: {e}', file=sys.stderr) def expire_old_revisions(self, db) -> None: """