Message285112
This patch doesn't change current behavior of "decode by chunk".
It's difficult to support changing encoding via header, like
Python's encoding cookie.
>>> import io
>>> buff = io.BytesIO("hello\nこんにちは".encode('utf-8'))
>>> f = io.TextIOWrapper(buff, encoding='ascii')
>>> f.readline()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/inada-n/work/python/cpython/Lib/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe3 in position 6: ordinal not in range(128)
>>>
>>> buff = io.BytesIO("hello\nこんにちは".encode('utf-8'))
>>> f = io.TextIOWrapper(buff, encoding='ascii')
>>> f.read(6)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/inada-n/work/python/cpython/Lib/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe3 in position 6: ordinal not in range(128) |
|
Date |
User |
Action |
Args |
2017-01-10 13:20:09 | methane | set | recipients:
+ methane, loewis, ishimoto, ncoghlan, pitrou, vstinner, jwilk, mrabarnett, Arfrever, nikratio, rurpy2, berker.peksag, martin.panter, serhiy.storchaka, quad |
2017-01-10 13:20:09 | methane | set | messageid: <1484054409.6.0.0112956238648.issue15216@psf.upfronthosting.co.za> |
2017-01-10 13:20:09 | methane | link | issue15216 messages |
2017-01-10 13:20:09 | methane | create | |
|