mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Fix Bug #115907: encode '=' as '=3D' and not '=='
This commit is contained in:
parent
9351dd2084
commit
77249442a5
1 changed files with 122 additions and 121 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue