Fix Bug #115907: encode '=' as '=3D' and not '=='

This commit is contained in:
Jeremy Hylton 2000-10-05 17:24:33 +00:00
parent 9351dd2084
commit 77249442a5

View file

@ -18,9 +18,6 @@ def needsquoting(c, quotetabs):
def quote(c):
"""Quote a single character."""
if c == ESCAPE:
return ESCAPE * 2
else:
i = ord(c)
return ESCAPE + HEX[i/16] + HEX[i%16]
@ -28,14 +25,18 @@ def encode(input, output, quotetabs):
"""Read 'input', apply quoted-printable encoding, and write to 'output'.
'input' and 'output' are files with readline() and write() methods.
The 'quotetabs' flag indicates whether tabs should be quoted."""
The 'quotetabs' flag indicates whether tabs should be quoted.
"""
while 1:
line = input.readline()
if not line: break
if not line:
break
new = ''
last = line[-1:]
if last == '\n': line = line[:-1]
else: last = ''
if last == '\n':
line = line[:-1]
else:
last = ''
prev = ''
for c in line:
if needsquoting(c, quotetabs):