mirror of
https://git.freebsd.org/ports.git
synced 2025-05-21 03:23:10 -04:00
working correctly on certain environment. PR: 187397 Submitted by: poyopoyo@puripuri.plala.or.jp Approved by: maintainer timeout
15 lines
824 B
Python
15 lines
824 B
Python
--- feedparser/feedparser.py.orig 2014-03-10 01:45:12.000000000 +0900
|
|
+++ feedparser/feedparser.py 2014-03-10 01:45:53.000000000 +0900
|
|
@@ -3766,7 +3766,11 @@
|
|
chardet_encoding = None
|
|
tried_encodings = []
|
|
if chardet:
|
|
- chardet_encoding = unicode(chardet.detect(data)['encoding'] or '', 'ascii', 'ignore')
|
|
+ chardet_encoding = chardet.detect(data)['encoding']
|
|
+ if not chardet_encoding:
|
|
+ chardet_encoding = ''
|
|
+ if not isinstance(chardet_encoding, str):
|
|
+ chardet_encoding = str(chardet_encoding, 'ascii', 'ignore')
|
|
# try: HTTP encoding, declared XML encoding, encoding sniffed from BOM
|
|
for proposed_encoding in (rfc3023_encoding, xml_encoding, bom_encoding,
|
|
chardet_encoding, u'utf-8', u'windows-1252', u'iso-8859-2'):
|