From: Michael Tremer Date: Fri, 14 Oct 2022 12:49:39 +0000 (+0000) Subject: messages: Format emails in UTF-8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4238293da0f9cbb6725a4b08de239dfb1d1db9ef;p=pbs.git messages: Format emails in UTF-8 And don't encode the body as base64. Signed-off-by: Michael Tremer --- diff --git a/src/buildservice/messages.py b/src/buildservice/messages.py index df01ae12..d061d582 100644 --- a/src/buildservice/messages.py +++ b/src/buildservice/messages.py @@ -1,8 +1,10 @@ #!/usr/bin/python import email +import email.charset import email.mime.multipart import email.mime.text +import email.policy import logging import markdown import subprocess @@ -14,6 +16,12 @@ from . import users from .constants import TEMPLATESDIR +# Encode emails in UTF-8 by default +email.charset.add_charset("utf-8", email.charset.SHORTEST, email.charset.QP, "utf-8") + +# Default policy for internal email handling +policy = email.policy.HTTP + class Messages(base.Object): def init(self): self.templates = tornado.template.Loader(TEMPLATESDIR)