si pas d'encodage, on ne force rien

This commit is contained in:
Jean-Marie Favreau 2024-11-06 13:36:12 +01:00
parent 1f12e8b3fb
commit 41196cd32d

View File

@ -53,8 +53,13 @@ class SimpleDownloader(Downloader):
resource = urllib.request.urlopen(req, post_args)
else:
resource = urllib.request.urlopen(req)
data = resource.read().decode(resource.headers.get_content_charset())
charset = resource.headers.get_content_charset()
if charset:
data = resource.read().decode(charset)
else:
data = resource.read().decode()
return data
except Exception as e:
print(e)
return None