crawler: fix chinese encoding
parent
285e1e5f42
commit
2719bd6776
|
@ -149,6 +149,15 @@ class GZIPHandler(BaseHandler):
|
||||||
|
|
||||||
|
|
||||||
def detect_encoding(data, resp=None):
|
def detect_encoding(data, resp=None):
|
||||||
|
enc = detect_raw_encoding(data, resp)
|
||||||
|
|
||||||
|
if enc == 'gb2312':
|
||||||
|
enc = 'gbk'
|
||||||
|
|
||||||
|
return enc
|
||||||
|
|
||||||
|
|
||||||
|
def detect_raw_encoding(data, resp=None):
|
||||||
if resp is not None:
|
if resp is not None:
|
||||||
enc = resp.headers.get('charset')
|
enc = resp.headers.get('charset')
|
||||||
if enc is not None:
|
if enc is not None:
|
||||||
|
|
Loading…
Reference in New Issue