Handle encoding of None when decoding unicode

If encoding is None, decoding will throw the following TypeError:
TypeError: unicode() argument 2 must be string, not None

If this is the case, attempt to run without any set encoding
This commit is contained in:
Matt Sweeney
2012-09-25 15:35:30 -07:00
parent 5ce25688e0
commit b1610df282
+5
View File
@@ -834,6 +834,11 @@ class Response(object):
#
# So we try blindly encoding.
content = str(self.content, errors='replace')
except TypeError:
# A TypeError can be raised if encoding is None
#
# So we try blindly encoding.
content = str(self.content, errors='replace')
return content