Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #54697
| Date | 2013-09-24 14:33 +0100 |
|---|---|
| From | Tim Golden <mail@timgolden.me.uk> |
| Subject | Re: removing BOM prepended by codecs? |
| References | <52418D10.9080508@kent.ac.uk> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.295.1380029594.18130.python-list@python.org> (permalink) |
On 24/09/2013 14:01, J. Bagg wrote:
> I'm using:
>
> outputfile = codecs.open (fn, 'w+', 'utf-8', errors='strict')
Well for the life of me I can't make that produce a BOM on 2.7 or 3.4.
In other words:
<code>
import codecs
with codecs.open("temp.txt", "w+", "utf-8", errors="strict") as f:
f.write("abc")
with open("temp.txt", "rb") as f:
assert f.read()[:3] == b"abc"
</code>
works without any assertion failures on 2.7 and 3.4, both running on
Win7 and on 2.7 and 3.3 running on Linux.
Have I misunderstood your situation?
TJG
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: removing BOM prepended by codecs? Tim Golden <mail@timgolden.me.uk> - 2013-09-24 14:33 +0100
csiph-web