Skip to content
Myr

Merge branch 'fixencodings' of https://github.com/jerem/requests into develop

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Kenneth Reitz · committed by Kenneth Reitz · parents ac9f9b6, 95b0549 · Browse files · 1 file+5 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+5 added−3 removed

  • other:+5 added−3 removed

1 file+5 added−3 removed

modified:requests/utils.py+5 added-3 removed
177 unmodified lines
178179def stream_decode_response_unicode(iterator, r):180 """Stream decodes a iterator."""181 encoding = get_encoding_from_headers(r.headers)182 if encoding is None:182 try:183 decoder = codecs.getincrementaldecoder(str(encoding))(errors='replace')184 except LookupError:185 for item in iterator:186 yield item187 return186187 decoder = codecs.getincrementaldecoder(encoding)(errors='replace')188 for chunk in iterator:189 rv = decoder.decode(chunk)190 if rv:191 yield rv
26 unmodified lines
218 try:219 return unicode(r.content, encoding)220 except UnicodeError:221 tried_encodings.append(encoding)222 except LookupError:223 return r.content224225 # Fall back:226 try:227 return unicode(r.content, encoding, errors='replace')
100 unmodified lines