When a requests response object's text property is called, self.encoding is applied to self.content. Usually this is None and falls back to self.apparent_encoding.
Coverage increased (+0.5%) to 68.307% when pulling e43d1796d29b125c349c79c477741d48cf2a4ca2 on file_encodings into 14dae08ac127b86df96b326ce466d4c4854dff2c on master.
Coverage increased (+0.6%) to 68.433% when pulling d51f63fbf95fda40d4f9aea52bf0939929e9e2e4 on file_encodings into 14dae08ac127b86df96b326ce466d4c4854dff2c on master.
When a
requests
response object'stext
property is called,self.encoding
is applied toself.content
. Usually this isNone
and falls back toself.apparent_encoding
.In a case we were seeing though, a UTF-16-encoded XML file from a Windows machine was breaking this: since the
Content-Type
response header contained the stringtext
, ISO-8859-1 encoding was being applied (see http://docs.python-requests.org/en/latest/user/advanced/?highlight=encoding#encodings).Closes #10 by adding optional encodings and ability to convert CRLFs to
\n
.