kennethreitz/requests — pull request #909 by mjpieters (2012-10-25 15:47:38+00:00)
Title: Use a JSON-specific encoding detection when no encoding has been specified

Here's a proposed fix for issue #765.

When requesting JSON data for a response with no encoding specified, detect the encoding from `self.content` using a custom UTF encoding detector that uses knowledge about JSON to make an educated guess as to the encoding used.

If no encoding could be determined, decoding fails, or the JSON decoding fails, fall back to `self.text` and `chardet` guessing.