fix for a bug reported by shaohua pan (UnicodeDecodeError: 'ascii' codec can't decode...)

This commit is contained in:
Miroslav Stampar 2011-01-04 12:51:51 +00:00
parent d288c6d6e3
commit 709a7d156b
2 changed files with 3 additions and 1 deletions

View File

@ -134,6 +134,8 @@ def decodePage(page, contentEncoding, contentType):
if charset:
kb.pageEncoding = charset
page = getUnicode(page)
else:
page = getUnicode(page)
return page

View File

@ -271,7 +271,7 @@ class Connect:
responseMsg += "[#%d] (%d %s):\n" % (threadData.lastRequestUID, code, status)
if responseHeaders:
logHeaders = "\n".join(["%s: %s" % (getUnicode(key.capitalize()) if isinstance(key, basestring) else key, getUnicode(value)) for (key, value) in responseHeaders.items()])
logHeaders = "\n".join(["%s: %s" % (key.capitalize() if isinstance(key, basestring) else key, getUnicode(value)) for (key, value) in responseHeaders.items()])
logHTTPTraffic(requestMsg, "%s%s\n\n%s" % (responseMsg, logHeaders, page))