fix for a bug "ordinal not in range(128)" reported by bugtrace

This commit is contained in:
Miroslav Stampar 2010-11-12 11:48:25 +00:00
parent f83dd2251b
commit 697b32554c
2 changed files with 2 additions and 1 deletions

View File

@ -1095,7 +1095,7 @@ def sanitizeAsciiString(subject):
if ord(subject[i]) >= 128: if ord(subject[i]) >= 128:
index = i index = i
break break
if not index: if index is None:
return subject return subject
else: else:
return subject[:index] + "".join(subject[i] if ord(subject[i]) < 128 else '?' for i in xrange(index, len(subject))) return subject[:index] + "".join(subject[i] if ord(subject[i]) < 128 else '?' for i in xrange(index, len(subject)))

View File

@ -279,6 +279,7 @@ class Connect:
socket.setdefaulttimeout(conf.timeout) socket.setdefaulttimeout(conf.timeout)
page = sanitizeAsciiString(page) page = sanitizeAsciiString(page)
page = getUnicode(page)
parseResponse(page, responseHeaders) parseResponse(page, responseHeaders)
responseMsg += "[#%d] (%d %s):\n" % (requestID, code, status) responseMsg += "[#%d] (%d %s):\n" % (requestID, code, status)