Zirak <[email protected]> added the comment:
On irc, bitmancer suggested that this problem is already solved by the
email.message.EmailMessage class, as it is:
In [119]: m = email.message.EmailMessage()
In [120]: m.set_content('abc', 'utf8', cte='base64')
In [121]: m.get_payload()
Out[121]: 'YWJjCg==\n'
In [122]: m.set_content('abc', 'utf8', cte='base64')
In [123]: m.get_payload()
Out[123]: 'YWJjCg==\n'
In [124]: m.get_payload(decode=True)
Out[124]: b'abc\n'
In [125]: print(m)
MIME-Version: 1.0
Content-Type: text/utf8; charset="utf-8"
Content-Transfer-Encoding: base64
YWJjCg==
Because this isn't a critical bug and `email.message.Message` is quite
deprecated, and this is solved by a newer API, this bug may not need
addressing.
----------
resolution: -> wont fix
stage: -> resolved
status: open -> closed
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue31820>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com