Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #54698

Re: removing BOM prepended by codecs?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eweka.nl!lightspeed.eweka.nl!194.109.133.87.MISMATCH!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.005
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'method.': 0.07; 'string': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; "'utf-8',": 0.16; 'conceivably': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'thread?': 0.16; 'appropriate': 0.16; 'wrote:': 0.18; 'file,': 0.19; 'passing': 0.19; 'header:User-Agent:1': 0.23; 'unicode': 0.24; 'file.': 0.24; '(or': 0.24; 'script': 0.25; 'header:X-Complaints-To:1': 0.27; 'characters': 0.30; "i'm": 0.30; 'too.': 0.31; 'obscure': 0.31; 'languages': 0.32; 'run': 0.32; 'raw': 0.33; 'problem': 0.35; 'charset:us-ascii': 0.36; 'subject:?': 0.36; 'to:addr:python- list': 0.38; 'files': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'remove': 0.60; 'new': 0.61; "you're": 0.61; 'more': 0.64; "it'd": 0.84; 'write()': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Dave Angel <davea@davea.name>
Subject Re: removing BOM prepended by codecs?
Date Tue, 24 Sep 2013 13:35:46 +0000 (UTC)
References <52418D10.9080508@kent.ac.uk>
Mime-Version 1.0
Content-Type text/plain; charset=US-ASCII
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host 174.32.174.35
User-Agent XPN/1.2.6 (Street Spirit ; Linux)
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.296.1380029767.18130.python-list@python.org> (permalink)
Lines 26
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1380029767 news.xs4all.nl 15962 [2001:888:2000:d::a6]:47234
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:54698

Show key headers only | View raw


On 24/9/2013 09:01, J. Bagg wrote:

Why would you start a new thread?  just do a Reply-List (or Reply-All
and remove the extra names) to the appropriate message on the existing
thread.

> I'm using:
>
> outputfile = codecs.open (fn, 'w+', 'utf-8', errors='strict')

That won't be adding a BOM.  It appends to an existing file, which
already may have a BOM in it.  Or conceivably you have a BOM in your
unicode string that you're passing to write() method.

>
> to write as I know that the files are unicode compliant. I run the raw 
> files that are delivered through a Python script to check the unicode 
> and report problem characters which are then edited. The files use a 
> whole variety of languages from Sanskrit to Cyrillic and more obscure 
> ones too.
>
it'd be much nicere to remove it when writing the file.
-- 
DaveA

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: removing BOM prepended by codecs? Dave Angel <davea@davea.name> - 2013-09-24 13:35 +0000

csiph-web