summaryrefslogtreecommitdiffstats
path: root/Lib/mimify.py
diff options
context:
space:
mode:
authorunknown <tools@python.org>2001-07-04 10:15:58 (GMT)
committerunknown <tools@python.org>2001-07-04 10:15:58 (GMT)
commitfee75ac4e5322546065d8d21c23a66fa1c2a926e (patch)
tree623507e95939d47c682c5abf5725d7637abdadb3 /Lib/mimify.py
parent67bbd7a7734b1c9b11abb6e627ce79fa48e1dbef (diff)
downloadcpython-fee75ac4e5322546065d8d21c23a66fa1c2a926e.zip
cpython-fee75ac4e5322546065d8d21c23a66fa1c2a926e.tar.gz
cpython-fee75ac4e5322546065d8d21c23a66fa1c2a926e.tar.bz2
Fix for SF bug #425868.
We should not depend on two spaces between words, so use the white space after the to-be-encoded word only as lookahead and don't actually consume it in the regular expression.
Diffstat (limited to 'Lib/mimify.py')
-rwxr-xr-xLib/mimify.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/mimify.py b/Lib/mimify.py
index 3f0eeb9..6dc0921 100755
--- a/Lib/mimify.py
+++ b/Lib/mimify.py
@@ -253,7 +253,7 @@ def mime_encode(line, header):
line = line[i:]
return newline + line
-mime_header = re.compile('([ \t(]|^)([-a-zA-Z0-9_+]*[\177-\377][-a-zA-Z0-9_+\177-\377]*)([ \t)]|\n)')
+mime_header = re.compile('([ \t(]|^)([-a-zA-Z0-9_+]*[\177-\377][-a-zA-Z0-9_+\177-\377]*)(?=[ \t)]|\n)')
def mime_encode_header(line):
"""Code a single header line as quoted-printable."""
@@ -263,9 +263,9 @@ def mime_encode_header(line):
res = mime_header.search(line, pos)
if res is None:
break
- newline = '%s%s%s=?%s?Q?%s?=%s' % \
+ newline = '%s%s%s=?%s?Q?%s?=' % \
(newline, line[pos:res.start(0)], res.group(1),
- CHARSET, mime_encode(res.group(2), 1), res.group(3))
+ CHARSET, mime_encode(res.group(2), 1))
pos = res.end(0)
return newline + line[pos:]