From: Johannes Gorset Date: Sat, 21 Jan 2012 10:01:45 +0000 (+0100) Subject: Default the encoding of "text" media subtypes to "ISO-8859-1" X-Git-Tag: v0.10.0~15^2^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a0ae2e6c7b46eaa93fa972623d0fdfc576de242b;p=services%2Fpython-requests.git Default the encoding of "text" media subtypes to "ISO-8859-1" Ref. RFC2616 (HyperText Transfer Protocol), section 3.7.1 (Canonicalization and Text Defaults). --- 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.