[PATCH 07/10] Set charset in order to generate MIME headers

Konstantin Ryabitsev <[email protected]> Fri, 2 Oct 2020 19:29:12 -0400
Newsgroups org.kernel.lore.signatures
Message-ID <[email protected]>
Apparently, merely passing policy= doesn't generate the full set of
required headers, so make sure we do set_charset('utf-8').

Reported-by: Michał Mirosław <[email protected]>
Signed-off-by: Konstantin Ryabitsev <[email protected]>
---
 b4/ty.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/b4/ty.py b/b4/ty.py
index 382ce93..cbee06a 100644
--- a/b4/ty.py
+++ b/b4/ty.py
@@ -426,9 +426,9 @@ def send_messages(listing, gitdir, outdir, branch, since='1.week'):
         outgoing += 1
         outfile = os.path.join(outdir, '%s.thanks' % slug)
         logger.info('  Writing: %s', outfile)
-        bout = msg.as_string(policy=b4.emlpolicy)
+        msg.set_charset('utf-8')
         with open(outfile, 'wb') as fh:
-            fh.write(bout.encode('utf-8'))
+            fh.write(msg.as_bytes())
         logger.debug('Cleaning up: %s', jsondata['trackfile'])
         fullpath = os.path.join(datadir, jsondata['trackfile'])
         os.rename(fullpath, '%s.sent' % fullpath)
-- 
2.26.2