Skip to content

Commit

Permalink
fix response with utf8 bom
Browse files Browse the repository at this point in the history
  • Loading branch information
Eduardo Rodrigues committed Feb 9, 2019
1 parent 9e27326 commit 19cff44
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions requests/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,9 @@ def text(self):
# Fallback to auto-detected encoding.
if self.encoding is None:
encoding = self.apparent_encoding
# Forcefully remove BOM from UTF-8
elif self.encoding.lower() == 'utf-8':
encoding = 'utf-8-sig'

# Decode unicode from given encoding.
try:
Expand Down

0 comments on commit 19cff44

Please sign in to comment.