Skip to content
Myr

Ignore unknown encoding.

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

authored by Jérémy Bethmont · committed by Jérémy Bethmont · parent 784b671 · 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
179 unmodified lines
180181def stream_decode_response_unicode(iterator, r):182 """Stream decodes a iterator."""183 encoding = get_encoding_from_headers(r.headers)184 if encoding is None:184 try:185 decoder = codecs.getincrementaldecoder(str(encoding))(errors='replace')186 except LookupError:187 for item in iterator:188 yield item189 return188189 decoder = codecs.getincrementaldecoder(encoding)(errors='replace')190 for chunk in iterator:191 rv = decoder.decode(chunk)192 if rv:193 yield rv
26 unmodified lines
220 try:221 return unicode(r.content, encoding)222 except UnicodeError:223 tried_encodings.append(encoding)224 except LookupError:225 return r.content226227 # Fall back:228 try:229 return unicode(r.content, encoding, errors='replace')
97 unmodified lines