Commit fee75ac4 authored by unknown's avatar unknown

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.
parent 67bbd7a7
...@@ -253,7 +253,7 @@ def mime_encode(line, header): ...@@ -253,7 +253,7 @@ def mime_encode(line, header):
line = line[i:] line = line[i:]
return newline + line 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): def mime_encode_header(line):
"""Code a single header line as quoted-printable.""" """Code a single header line as quoted-printable."""
...@@ -263,9 +263,9 @@ def mime_encode_header(line): ...@@ -263,9 +263,9 @@ def mime_encode_header(line):
res = mime_header.search(line, pos) res = mime_header.search(line, pos)
if res is None: if res is None:
break 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), (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) pos = res.end(0)
return newline + line[pos:] return newline + line[pos:]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment