[New-bugs-announce] [issue16948] email.mime.text.MIMEText: QP encoding broken with charset!=ISO-8859-1
Jakub Wilk
report at bugs.python.org
Sat Jan 12 19:52:55 CET 2013
New submission from Jakub Wilk:
If you try to create MIMEText object with text containing characters outside the ISO-8859-1 range,
the quoted-printable encoder fails with KeyError:
Python 3.2.3 (default, Sep 10 2012, 12:58:42)
[GCC 4.7.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import email.mime.text
>>> email.mime.text.MIMEText('\u017c', 'plain', 'ISO-8859-2')
Traceback (most recent call last):
File "/usr/lib/python3.2/email/message.py", line 331, in set_charset
cte(self)
TypeError: 'str' object is not callable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.2/email/mime/text.py", line 30, in __init__
self.set_payload(_text, _charset)
File "/usr/lib/python3.2/email/message.py", line 296, in set_payload
self.set_charset(charset)
File "/usr/lib/python3.2/email/message.py", line 333, in set_charset
self._payload = charset.body_encode(self._payload)
File "/usr/lib/python3.2/email/charset.py", line 395, in body_encode
return email.quoprimime.body_encode(string)
File "/usr/lib/python3.2/email/quoprimime.py", line 240, in body_encode
if body_check(ord(c)):
File "/usr/lib/python3.2/email/quoprimime.py", line 81, in body_check
return chr(octet) != _QUOPRI_BODY_MAP[octet]
KeyError: 380
----------
components: Library (Lib)
messages: 179826
nosy: jwilk
priority: normal
severity: normal
status: open
title: email.mime.text.MIMEText: QP encoding broken with charset!=ISO-8859-1
versions: Python 3.2
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16948>
_______________________________________
More information about the New-bugs-announce
mailing list