Rework previous fix slightly; the &0x20 test seems useless, and the isprint() check mustn't prevent the meta-bit check at the end

This commit is contained in:
Andrew M. Kuchling 2003-08-29 18:50:59 +00:00
parent e8792c1f65
commit b738041c5d
1 changed files with 2 additions and 4 deletions

View File

@ -87,13 +87,11 @@ def alt(c):
return _ctoi(c) | 0x80
def unctrl(c):
if isprint(c):
return chr(_ctoi(c))
bits = _ctoi(c)
if bits == 0x7f:
rep = "^?"
elif bits & 0x20:
rep = chr((bits & 0x7f) | 0x20)
elif isprint(bits & 0x7f):
rep = chr(bits & 0x7f)
else:
rep = "^" + chr(((bits & 0x7f) | 0x20) + 0x20)
if bits & 0x80: