Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[3.14] Correctly fold unknown-8bit originating from encoded words. (GH-142517)#143146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
bitdancer merged 2 commits intopython:3.14frommiss-islington:backport-1e17ccd-3.14
Dec 24, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletionLib/email/_encoded_words.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -219,7 +219,7 @@ def encode(string, charset='utf-8', encoding=None, lang=''):

"""
if charset == 'unknown-8bit':
bstring = string.encode('ascii', 'surrogateescape')
bstring = string.encode('utf-8', 'surrogateescape')
else:
bstring = string.encode(charset)
if encoding is None:
Expand Down
8 changes: 8 additions & 0 deletionsLib/test/test_email/test__header_value_parser.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3340,5 +3340,13 @@ def test_fold_unfoldable_element_stealing_whitespace(self):
token = parser.get_address_list(text)[0]
self._test(token, expected, policy=policy)

def test_encoded_word_with_undecodable_bytes(self):
self._test(parser.get_address_list(
' =?utf-8?Q?=E5=AE=A2=E6=88=B6=E6=AD=A3=E8=A6=8F=E4=BA=A4=E7?='
)[0],
' =?unknown-8bit?b?5a6i5oi25q2j6KaP5Lqk5w==?=\n',
)


if __name__ == '__main__':
unittest.main()
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
The non-``compat32`` :mod:`email` policies now correctly handle refolding
encoded words that contain bytes that can not be decoded in their specified
character set. Previously this resulted in an encoding exception during
folding.
Loading

[8]ページ先頭

©2009-2026 Movatter.jp