Fix regex implementation.
parent
ee08cccf9c
commit
9f175994c6
6
morss.py
6
morss.py
|
@ -261,10 +261,10 @@ def EncDownload(url):
|
||||||
log('header')
|
log('header')
|
||||||
enc = con.headers.getparam('charset')
|
enc = con.headers.getparam('charset')
|
||||||
else:
|
else:
|
||||||
match = re.search('charset=["\']?([0-9a-zA-Z-]+)', data).groups()
|
match = re.search('charset=["\']?([0-9a-zA-Z-]+)', data)
|
||||||
if len(match):
|
if match:
|
||||||
log('meta.re')
|
log('meta.re')
|
||||||
enc = match[0]
|
enc = match.groups()[0]
|
||||||
else:
|
else:
|
||||||
log('chardet')
|
log('chardet')
|
||||||
enc = chardet.detect(data)['encoding']
|
enc = chardet.detect(data)['encoding']
|
||||||
|
|
Loading…
Reference in New Issue