Message209377
Second question:
The following looks as if a BOM might be written for writeable, non-seekable streams:
# don't write a BOM in the middle of a file
if self._seekable and self.writable():
position = self.buffer.tell()
if position != 0:
try:
self._get_encoder().setstate(0)
except LookupError:
# Sometimes the encoder doesn't exist
pass
Is that really desirable? It seems to me the safe choice is to *not* write the BOM, except when we know it's safe. Eg:
# don't write a BOM unless we know we're at the beginning of a file
if (self.writeable() and not
(self._seekable and self.buffer.tell() == 0)):
try:
self._get_encoder().setstate(0)
except LookupError:
# Sometimes the encoder doesn't exist
pass |
|
Date |
User |
Action |
Args |
2014-01-27 02:13:41 | nikratio | set | recipients:
+ nikratio, loewis, ishimoto, ncoghlan, pitrou, vstinner, jwilk, mrabarnett, Arfrever, methane, rurpy2, serhiy.storchaka, elixir |
2014-01-27 02:13:41 | nikratio | set | messageid: <1390788821.56.0.406260063646.issue15216@psf.upfronthosting.co.za> |
2014-01-27 02:13:41 | nikratio | link | issue15216 messages |
2014-01-27 02:13:41 | nikratio | create | |
|