From 6c2f1fd71075ced14e7ba40e232297ba878aadd1 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sun, 17 Jul 2016 13:25:15 +0300 Subject: [PATCH] Issues #23147, #23148: Presumably fixed bugs in folding UnstructuredTokenList. --- Lib/email/_header_value_parser.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/email/_header_value_parser.py b/Lib/email/_header_value_parser.py index 2226e137e1a..5df9511e8d9 100644 --- a/Lib/email/_header_value_parser.py +++ b/Lib/email/_header_value_parser.py @@ -439,7 +439,7 @@ class UnstructuredTokenList(TokenList): if folded.append_if_fits(part): continue if part.has_fws: - part.fold(folded) + part._fold(folded) continue # It can't be split...we just have to put it on its own line. folded.append(tstr) @@ -460,7 +460,7 @@ class UnstructuredTokenList(TokenList): last_ew = len(res) else: tl = get_unstructured(''.join(res[last_ew:] + [spart])) - res.append(tl.as_encoded_word()) + res.append(tl.as_encoded_word(charset)) return ''.join(res)