summaryrefslogtreecommitdiffstats
path: root/Lib/email/header.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/email/header.py')
-rw-r--r--Lib/email/header.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/Lib/email/header.py b/Lib/email/header.py
index 94eb1a9..d462bf0 100644
--- a/Lib/email/header.py
+++ b/Lib/email/header.py
@@ -305,10 +305,15 @@ class Header:
self._continuation_ws, splitchars)
for string, charset in self._chunks:
lines = string.splitlines()
- for line in lines:
+ formatter.feed(lines[0], charset)
+ for line in lines[1:]:
+ formatter.newline()
+ if charset.header_encoding is not None:
+ formatter.feed(self._continuation_ws, USASCII)
+ line = ' ' + line.lstrip()
formatter.feed(line, charset)
- if len(lines) > 1:
- formatter.newline()
+ if len(lines) > 1:
+ formatter.newline()
formatter.add_transition()
return formatter._str(linesep)