Fix JSON related encoding issue
parent
c43bf9f35f
commit
e3f525ff2a
4
feeds.py
4
feeds.py
|
@ -51,7 +51,9 @@ def parse(data):
|
||||||
match = re.search('encoding=["\']?([0-9a-zA-Z-]+)', data[:100])
|
match = re.search('encoding=["\']?([0-9a-zA-Z-]+)', data[:100])
|
||||||
if match:
|
if match:
|
||||||
enc = match.groups()[0].lower()
|
enc = match.groups()[0].lower()
|
||||||
data = data.decode(enc, 'ignore').encode(enc)
|
if not isinstance(data, unicode):
|
||||||
|
data = data.decode(enc, 'ignore')
|
||||||
|
data = data.encode(enc)
|
||||||
|
|
||||||
# parse
|
# parse
|
||||||
parser = etree.XMLParser(recover=True)
|
parser = etree.XMLParser(recover=True)
|
||||||
|
|
Loading…
Reference in New Issue