From a0ae2e6c7b46eaa93fa972623d0fdfc576de242b Mon Sep 17 00:00:00 2001 From: Johannes Gorset Date: Sat, 21 Jan 2012 11:01:45 +0100 Subject: [PATCH] Default the encoding of "text" media subtypes to "ISO-8859-1" Ref. RFC2616 (HyperText Transfer Protocol), section 3.7.1 (Canonicalization and Text Defaults). --- requests/utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/requests/utils.py b/requests/utils.py index c7ab0a4..95dea4b 100644 --- a/requests/utils.py +++ b/requests/utils.py @@ -276,6 +276,9 @@ def get_encoding_from_headers(headers): if 'charset' in params: return params['charset'].strip("'\"") + if 'text' in content_type: + return 'ISO-8859-1' + def unicode_from_html(content): """Attempts to decode an HTML string into unicode. -- 2.7.4