Skip to content

Commit

Permalink
Default the encoding of "text" media subtypes to "ISO-8859-1"
Browse files Browse the repository at this point in the history
Ref. RFC2616 (HyperText Transfer Protocol), section 3.7.1 (Canonicalization and Text Defaults).
  • Loading branch information
jgorset committed Jan 21, 2012
1 parent 5bff8e3 commit a0ae2e6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions requests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit a0ae2e6

Please sign in to comment.