explicating the cause of LookupError with a better comment

This commit is contained in:
Max Countryman
2012-03-11 22:22:29 -04:00
parent bc5cc0dc92
commit 83a9f2c740
+4 -1
View File
@@ -789,7 +789,10 @@ class Response(object):
try:
content = str(self.content, encoding, errors='replace')
except LookupError:
# try blindly encoding
# A LookupError is raised if the encoding was not found which could
# indicate a misspelling or similar mistake.
#
# So we try blindly encoding.
content = str(self.content, errors='replace')
except (UnicodeError, TypeError):
pass