Webtool: if charset contain also language, ignore language

This commit is contained in:
nemunaire 2014-06-26 23:32:25 +02:00
parent 05a148fef4
commit c5ee6084c0

View File

@ -100,7 +100,12 @@ def getURLContent(url, timeout=15):
for c in charset: for c in charset:
ch = c.split("=") ch = c.split("=")
if ch[0].strip().lower() == "charset" and len(ch) > 1: if ch[0].strip().lower() == "charset" and len(ch) > 1:
data = data.decode(ch[1]) cha = ch[1].split(".")
if len(cha) > 1:
charset = cha[1]
else:
charset = cha[0]
data = data.decode(charset)
except http.client.BadStatusLine: except http.client.BadStatusLine:
return None return None
finally: finally: