Line 0
Link Here
|
|
|
1 |
--- feedparser/feedparser.py.orig 2014-03-10 01:45:12.000000000 +0900 |
2 |
+++ feedparser/feedparser.py 2014-03-10 01:45:53.000000000 +0900 |
3 |
@@ -3766,7 +3766,11 @@ |
4 |
chardet_encoding = None |
5 |
tried_encodings = [] |
6 |
if chardet: |
7 |
- chardet_encoding = unicode(chardet.detect(data)['encoding'] or '', 'ascii', 'ignore') |
8 |
+ chardet_encoding = chardet.detect(data)['encoding'] |
9 |
+ if not chardet_encoding: |
10 |
+ chardet_encoding = '' |
11 |
+ if not isinstance(chardet_encoding, str): |
12 |
+ chardet_encoding = str(chardet_encoding, 'ascii', 'ignore') |
13 |
# try: HTTP encoding, declared XML encoding, encoding sniffed from BOM |
14 |
for proposed_encoding in (rfc3023_encoding, xml_encoding, bom_encoding, |
15 |
chardet_encoding, u'utf-8', u'windows-1252', u'iso-8859-2'): |