Skip to content

Commit b7ddcc3

Browse files
miss-islingtonZeroIntensityrapidcow
authored
[3.13] gh-121542: Document trailing newline behavior in set_content() (GH-121543) (#128995)
gh-121542: Document trailing newline behavior in `set_content()` (GH-121543) (cherry picked from commit fba475a) Co-authored-by: Peter Bierma <[email protected]> Co-authored-by: Yizheng Meng <[email protected]>
1 parent fdac362 commit b7ddcc3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Doc/library/email.contentmanager.rst

+7-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,13 @@ Currently the email package provides only one concrete content manager,
157157
:exc:`ValueError`.
158158

159159
* For ``str`` objects, if *cte* is not set use heuristics to
160-
determine the most compact encoding.
160+
determine the most compact encoding. Prior to encoding,
161+
:meth:`str.splitlines` is used to normalize all line boundaries,
162+
ensuring that each line of the payload is terminated by the
163+
current policy's :data:`~email.policy.Policy.linesep` property
164+
(even if the original string did not end with one).
165+
* For ``bytes`` objects, *cte* is taken to be base64 if not set,
166+
and the aforementioned newline translation is not performed.
161167
* For :class:`~email.message.EmailMessage`, per :rfc:`2046`, raise
162168
an error if a *cte* of ``quoted-printable`` or ``base64`` is
163169
requested for *subtype* ``rfc822``, and for any *cte* other than

0 commit comments

Comments
 (0)