Message205944
In Lib/email/encoders.py:
def encode_7or8bit(msg):
"""Set the Content-Transfer-Encoding header to 7bit or 8bit."""
orig = msg.get_payload(decode=True)
if orig is None:
# There's no payload. For backwards compatibility we use 7bit
msg['Content-Transfer-Encoding'] = '7bit'
return
# We play a trick to make this go fast. If encoding/decode to ASCII
# succeeds, we know the data must be 7bit, otherwise treat it as 8bit.
try:
if isinstance(orig, str):
orig.encode('ascii')
else:
orig.decode('ascii')
except UnicodeError:
charset = msg.get_charset()
msg.get_payload(decode=True) always return bytes so there is no point of these lines:
if isinstance(orig, str):
orig.encode('ascii')
else:
orig.decode('ascii')
Attached the patch to refactor this function. |
|
Date |
User |
Action |
Args |
2013-12-12 06:21:19 | vajrasky | set | recipients:
+ vajrasky, barry, r.david.murray |
2013-12-12 06:21:19 | vajrasky | set | messageid: <1386829279.51.0.373470600297.issue19957@psf.upfronthosting.co.za> |
2013-12-12 06:21:19 | vajrasky | link | issue19957 messages |
2013-12-12 06:21:18 | vajrasky | create | |
|