mirror of
https://github.com/soimort/you-get.git
synced 2025-02-11 20:52:31 +03:00
get encoding from response date
fix #622 Signed-off-by: Zhang Ning <zhangn1985@gmail.com>
This commit is contained in:
parent
25c769df2e
commit
9abf54ead5
@ -192,7 +192,8 @@ def get_content(url, headers={}, decoded=True):
|
|||||||
|
|
||||||
# Decode the response body
|
# Decode the response body
|
||||||
if decoded:
|
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:
|
if charset is not None:
|
||||||
data = data.decode(charset)
|
data = data.decode(charset)
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user