summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorR. David Murray <rdmurray@bitdance.com>2010-06-02 22:03:15 (GMT)
committerR. David Murray <rdmurray@bitdance.com>2010-06-02 22:03:15 (GMT)
commit52dcd4590652e3c6f57a94fb57a5522880b7d72b (patch)
treed8361501f980bff3a999186ff2ac1a961584e9c8 /Doc
parentc395545a4ab4b4760c0472af74f526f405389864 (diff)
downloadcpython-52dcd4590652e3c6f57a94fb57a5522880b7d72b.zip
cpython-52dcd4590652e3c6f57a94fb57a5522880b7d72b.tar.gz
cpython-52dcd4590652e3c6f57a94fb57a5522880b7d72b.tar.bz2
#1368247: make set_charset/MIMEText automatically encode unicode _payload.
Fixes (mysterious, to the end user) UnicodeErrors when using utf-8 as the charset and unicode as the _text argument. Also makes the way in which unicode gets encoded to quoted printable for other charsets more sane (it only worked by accident previously). The _payload now is encoded to the charset.output_charset if it is unicode.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/email.message.rst7
-rw-r--r--Doc/library/email.mime.rst8
2 files changed, 9 insertions, 6 deletions
diff --git a/Doc/library/email.message.rst b/Doc/library/email.message.rst
index 5ebc960..fa1df88 100644
--- a/Doc/library/email.message.rst
+++ b/Doc/library/email.message.rst
@@ -136,9 +136,10 @@ Here are the methods of the :class:`Message` class:
:mailheader:`Content-Type` header. Anything else will generate a
:exc:`TypeError`.
- The message will be assumed to be of type :mimetype:`text/\*` encoded with
- *charset.input_charset*. It will be converted to *charset.output_charset*
- and encoded properly, if needed, when generating the plain text
+ The message will be assumed to be of type :mimetype:`text/\*`, with the
+ payload either in unicode or encoded with *charset.input_charset*.
+ It will be encoded or converted to *charset.output_charset*
+ and transfer encoded properly, if needed, when generating the plain text
representation of the message. MIME headers (:mailheader:`MIME-Version`,
:mailheader:`Content-Type`, :mailheader:`Content-Transfer-Encoding`) will
be added as needed.
diff --git a/Doc/library/email.mime.rst b/Doc/library/email.mime.rst
index 10f3e37..a092feb 100644
--- a/Doc/library/email.mime.rst
+++ b/Doc/library/email.mime.rst
@@ -191,9 +191,11 @@ Here are the classes:
minor type and defaults to :mimetype:`plain`. *_charset* is the character
set of the text and is passed as a parameter to the
:class:`~email.mime.nonmultipart.MIMENonMultipart` constructor; it defaults
- to ``us-ascii``. No guessing or encoding is performed on the text data.
+ to ``us-ascii``. If *_text* is unicode, it is encoded using the
+ *output_charset* of *_charset*, otherwise it is used as-is.
.. versionchanged:: 2.4
- The previously deprecated *_encoding* argument has been removed. Encoding
- happens implicitly based on the *_charset* argument.
+ The previously deprecated *_encoding* argument has been removed. Content
+ Transfer Encoding now happens happens implicitly based on the *_charset*
+ argument.