summaryrefslogtreecommitdiffstats
path: root/Misc/NEWS.d
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2024-05-20 20:01:56 (GMT)
committerGitHub <noreply@github.com>2024-05-20 20:01:56 (GMT)
commit054f1af8119540f5e05062fdee0beb17d42c68be (patch)
tree67082c2784110e53836549dcfa0aa633d42f388c /Misc/NEWS.d
parentd8c562af55a0b475693ac78b92c477b3416a5ed0 (diff)
downloadcpython-054f1af8119540f5e05062fdee0beb17d42c68be.zip
cpython-054f1af8119540f5e05062fdee0beb17d42c68be.tar.gz
cpython-054f1af8119540f5e05062fdee0beb17d42c68be.tar.bz2
[3.13] gh-92081: Fix for email.generator.Generator with whitespace between encoded words. (GH-92281) (#119245)
* Fix for email.generator.Generator with whitespace between encoded words. email.generator.Generator currently does not handle whitespace between encoded words correctly when the encoded words span multiple lines. The current generator will create an encoded word for each line. If the end of the line happens to correspond with the end real word in the plaintext, the generator will place an unencoded space at the start of the subsequent lines to represent the whitespace between the plaintext words. A compliant decoder will strip all the whitespace from between two encoded words which leads to missing spaces in the round-tripped output. The fix for this is to make sure that whitespace between two encoded words ends up inside of one or the other of the encoded words. This fix places the space inside of the second encoded word. A second problem happens with continuation lines. A continuation line that starts with whitespace and is followed by a non-encoded word is fine because the newline between such continuation lines is defined as condensing to a single space character. When the continuation line starts with whitespace followed by an encoded word, however, the RFCs specify that the word is run together with the encoded word on the previous line. This is because normal words are filded on syntactic breaks by encoded words are not. The solution to this is to add the whitespace to the start of the encoded word on the continuation line. Test cases are from GH-92081 * Rename a variable so it's not confused with the final variable. (cherry picked from commit a6fdb31b6714c9f3c65fefbb3fe388b2b139a75f) Co-authored-by: Toshio Kuratomi <a.badger@gmail.com>
Diffstat (limited to 'Misc/NEWS.d')
-rw-r--r--Misc/NEWS.d/next/Library/2023-04-26-22-24-17.gh-issue-92081.V8xMot.rst1
1 files changed, 1 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2023-04-26-22-24-17.gh-issue-92081.V8xMot.rst b/Misc/NEWS.d/next/Library/2023-04-26-22-24-17.gh-issue-92081.V8xMot.rst
new file mode 100644
index 0000000..0302e95
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2023-04-26-22-24-17.gh-issue-92081.V8xMot.rst
@@ -0,0 +1 @@
+Fix missing spaces in email headers when the spaces are mixed with encoded 8-bit characters.