Merge branch 'fix'

This commit is contained in:
Zhang Ning 2015-09-05 09:56:57 +08:00
commit 54c6033595

View File

@ -210,7 +210,8 @@ def get_content(url, headers={}, decoded=True):
# Decode the response body
if decoded:
charset = match1(response.getheader('Content-Type'), r'charset=([\w-]+)')
charset = match1(response.getheader('Content-Type'), r'charset=([\w-]+)') or \
match1(str(data), r'charset=([\w-]+)')
if charset is not None:
data = data.decode(charset)
else: