Author flox
Recipients amaury.forgeotdarc, beazley, flox, lemburg, vstinner
Date 2009-12-14.21:25:23
SpamBayes Score 1.88911e-06
Marked as misclassified No
Message-id <1260825925.49.0.753289103795.issue4770@psf.upfronthosting.co.za>
In-reply-to
Content
> Are you sure that this patch is correct (which RFC says
> that quoted printable should use our raw-unicode-escape
> codec ?):

I am not sure of anything. It is an "educated guess" at the most.
Since 'base64' and 'x-uuencode' both use 'raw-unicode-escape'...

See longer excerpt below.


Index: Lib/email/message.py
===================================================================
--- Lib/email/message.py        (revision 76839)
+++ Lib/email/message.py        (working copy)
@@ -189,24 +189,26 @@
         elif not isinstance(self._payload, list):
             raise TypeError('Expected list, got %s' % type(self._payload))
         else:
             payload = self._payload[i]
         if not decode:
             return payload
         # Decoded payloads always return bytes.  XXX split this part
out into
         # a new method called .get_decoded_payload().
         if self.is_multipart():
             return None
         cte = self.get('content-transfer-encoding', '').lower()
         if cte == 'quoted-printable':
+            if isinstance(payload, str):
+                payload = payload.encode('raw-unicode-escape')
             return utils._qdecode(payload)
         elif cte == 'base64':
             try:
                 if isinstance(payload, str):
                     payload = payload.encode('raw-unicode-escape')
                 return base64.b64decode(payload)
                 #return utils._bdecode(payload)
             except binascii.Error:
                 # Incorrect padding
                 pass
         elif cte in ('x-uuencode', 'uuencode', 'uue', 'x-uue'):
             in_file = BytesIO(payload.encode('raw-unicode-escape'))
History
Date User Action Args
2009-12-14 21:25:25floxsetrecipients: + flox, lemburg, beazley, amaury.forgeotdarc, vstinner
2009-12-14 21:25:25floxsetmessageid: <1260825925.49.0.753289103795.issue4770@psf.upfronthosting.co.za>
2009-12-14 21:25:24floxlinkissue4770 messages
2009-12-14 21:25:23floxcreate