Message209377
| Author |
nikratio |
| Recipients |
Arfrever, elixir, ishimoto, jwilk, loewis, methane, mrabarnett, ncoghlan, nikratio, pitrou, rurpy2, serhiy.storchaka, vstinner |
| Date |
2014年01月27日.02:13:41 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1390788821.56.0.406260063646.issue15216@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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 |
|
History
|
|---|
| 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 |
|