removing BOM prepended by codecs?

Dave Angel davea at davea.name
Tue Sep 24 09:35:46 EDT 2013


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





More information about the Python-list mailing list