Marc-Andre Lemburg <m...@egenix.com> added the comment:

flox wrote:
> 
> flox <la...@yahoo.fr> added the comment:
> 
> This patch removes implicit encoding in binascii functions:
>  - a2b_hex (=unhexlify)
>  - a2b_qp
>  - rledecode_hqx 
> 
>  * Tests module "test_binascii" is reviewed and simplified.
>  * Fixes for "email", "pickle" and "quopri" modules to encode input.
> 
> All tests pass.

Are you sure that this patch is correct (which RFC says
that quoted printable should use our raw-unicode-escape
codec ?):

Index: Lib/email/message.py
===================================================================
--- Lib/email/message.py        (revision 76839)
+++ Lib/email/message.py        (working copy)
@@ -198,6 +198,8 @@
             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:

The patch also needs to fix the documentation and add a NEWS
entry.

Making these APIs strict in the sense that they don't accept
str-instances anymore needs to be mentioned very clearly.

We may even have to go through a deprecation process for them,
since they can easily cause perfectly working code to suddenly
fail.

----------
nosy: +lemburg

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue4770>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to