update regarding Unicode char logging (Bug #148)

This commit is contained in:
Miroslav Stampar 2010-01-23 15:36:55 +00:00
parent 97840535c6
commit 39652bfbf4

View File

@ -29,6 +29,7 @@ import time
import urllib2 import urllib2
import urlparse import urlparse
import traceback import traceback
import unicodedata
from lib.contrib import multipartpost from lib.contrib import multipartpost
from lib.core.convert import urlencode from lib.core.convert import urlencode
@ -74,7 +75,7 @@ class Connect:
cookieStr = "" cookieStr = ""
requestMsg = "HTTP request:\n%s " % conf.method requestMsg = "HTTP request:\n%s " % conf.method
requestMsg += "%s" % urlparse.urlsplit(url)[2] or "/" requestMsg += "%s" % urlparse.urlsplit(url)[2] or "/"
responseMsg = "HTTP response " responseMsg = u"HTTP response "
requestHeaders = "" requestHeaders = ""
responseHeaders = "" responseHeaders = ""
@ -228,6 +229,7 @@ class Connect:
elif conf.verbose > 4: elif conf.verbose > 4:
responseMsg += "%s\n%s\n" % (responseHeaders, page) responseMsg += "%s\n%s\n" % (responseHeaders, page)
responseMsg = unicodedata.normalize('NFKD', responseMsg).encode('ascii','ignore')
logger.log(8, responseMsg) logger.log(8, responseMsg)
return page, responseHeaders return page, responseHeaders