Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs

[issue6521] Contradictory documentation for email.mime.text.MIMEText

 

 

Python bugs RSS feed   Index | Next | Previous | View Threaded


report at bugs

Jul 19, 2009, 6:19 AM

Post #1 of 3 (150 views)
Permalink
[issue6521] Contradictory documentation for email.mime.text.MIMEText

New submission from Antoine Pitrou <pitrou[at]free.fr>:

It is not obvious whether encoding of an unicode argument will happen or
not:

« [...] No guessing or encoding is performed on the text data.

Changed in version 2.4: The previously deprecated _encoding argument has
been removed. Encoding happens implicitly based on the _charset argument. »

http://docs.python.org/library/email.mime.html#email.mime.text.MIMEText

----------
assignee: georg.brandl
components: Documentation
messages: 90711
nosy: georg.brandl, pitrou
severity: normal
stage: needs patch
status: open
title: Contradictory documentation for email.mime.text.MIMEText
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2

_______________________________________
Python tracker <report[at]bugs.python.org>
<http://bugs.python.org/issue6521>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jul 19, 2009, 6:22 AM

Post #2 of 3 (132 views)
Permalink
[issue6521] Contradictory documentation for email.mime.text.MIMEText [In reply to]

Antoine Pitrou <pitrou[at]free.fr> added the comment:

Apparently it doesn't:

>>> message = MIMEText(u"héhé", _charset="utf-8")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python2.6/email/mime/text.py", line 30, in __init__
self.set_payload(_text, _charset)
File "/usr/lib64/python2.6/email/message.py", line 224, in set_payload
self.set_charset(charset)
File "/usr/lib64/python2.6/email/message.py", line 266, in set_charset
self._payload = charset.body_encode(self._payload)
File "/usr/lib64/python2.6/email/charset.py", line 387, in body_encode
return email.base64mime.body_encode(s)
File "/usr/lib64/python2.6/email/base64mime.py", line 147, in encode
enc = b2a_base64(s[i:i + max_unencoded])
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in
position 1: ordinal not in range(128)

----------

_______________________________________
Python tracker <report[at]bugs.python.org>
<http://bugs.python.org/issue6521>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jul 19, 2009, 6:39 AM

Post #3 of 3 (133 views)
Permalink
[issue6521] Contradictory documentation for email.mime.text.MIMEText [In reply to]

Changes by Georg Brandl <georg[at]python.org>:


----------
assignee: georg.brandl -> barry
nosy: +barry

_______________________________________
Python tracker <report[at]bugs.python.org>
<http://bugs.python.org/issue6521>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

Python bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.