Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #54697 > unrolled thread
| Started by | Tim Golden <mail@timgolden.me.uk> |
|---|---|
| First post | 2013-09-24 14:33 +0100 |
| Last post | 2013-09-24 14:33 +0100 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: removing BOM prepended by codecs? Tim Golden <mail@timgolden.me.uk> - 2013-09-24 14:33 +0100
| From | Tim Golden <mail@timgolden.me.uk> |
|---|---|
| Date | 2013-09-24 14:33 +0100 |
| Subject | Re: removing BOM prepended by codecs? |
| Message-ID | <mailman.295.1380029594.18130.python-list@python.org> |
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 top | Article view | comp.lang.python
csiph-web