Fixing inane bug in feedparser when there isn't data but it's still trying to do character encoding detection. Should be fixed upstream.

This commit is contained in:
Samuel Clay 2012-07-01 13:32:00 -07:00
parent 3a95882c48
commit 7dedeaaa6c

View file

@ -3739,7 +3739,7 @@ def convert_to_utf8(http_headers, data):
known_encoding = 0
chardet_encoding = None
tried_encodings = []
if chardet:
if chardet and data:
chardet_encoding = unicode(chardet.detect(data)['encoding'], 'ascii', 'ignore')
# try: HTTP encoding, declared XML encoding, encoding sniffed from BOM
for proposed_encoding in (rfc3023_encoding, xml_encoding, bom_encoding,