Skip to content

Commit

Permalink
Merge pull request #5673 from jjmaldonis/master
Browse files Browse the repository at this point in the history
updated `get_encoding_from_headers` to return utf-8 if the content type is set to application/json
  • Loading branch information
sigmavirus24 authored Nov 29, 2020
2 parents d0359c9 + 5855dd7 commit 589c454
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions requests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,10 @@ def get_encoding_from_headers(headers):
if 'text' in content_type:
return 'ISO-8859-1'

if 'application/json' in content_type:
# Assume UTF-8 based on RFC 4627: https://www.ietf.org/rfc/rfc4627.txt since the charset was unset
return 'utf-8'


def stream_decode_response_unicode(iterator, r):
"""Stream decodes a iterator."""
Expand Down

0 comments on commit 589c454

Please sign in to comment.