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


Groups > comp.lang.python > #64147

Re: Guessing the encoding from a BOM

From Mark Lawrence <breamoreboy@yahoo.co.uk>
Subject Re: Guessing the encoding from a BOM
Date 2014-01-17 09:10 +0000
References <CAPTjJmqyO0UHrq31510iNeoQ2TcrJnosV0A6oHQOt5i-gz3njA@mail.gmail.com> <1389901049.40172.YahooMailBasic@web163804.mail.gq1.yahoo.com> <CAPTjJmqNhokKF8X3jHNZrW0iEt8foTaMM+26a3+2O9FG4rMPpw@mail.gmail.com> <20140116194005.387a9125@bigbox.christie.dr>
Newsgroups comp.lang.python
Message-ID <mailman.5627.1389949840.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 17/01/2014 01:40, Tim Chase wrote:
> On 2014-01-17 11:14, Chris Angelico wrote:
>> UTF-8 specifies the byte order
>> as part of the protocol, so you don't need to mark it.
>
> You don't need to mark it when writing, but some idiots use it
> anyway.  If you're sniffing a file for purposes of reading, you need
> to look for it and remove it from the actual data that gets returned
> from the file--otherwise, your data can see it as corruption.  I end
> up with lots of CSV files from customers who have polluted it with
> Notepad or had Excel insert some UTF-8 BOM when exporting.  This
> means my first column-name gets the BOM prefixed onto it when the
> file is passed to csv.DictReader, grr.
>
> -tkc
>

My code that used to handle CSV files from M$ Money had to allow for a 
single NUL byte right at the end of the file.  Thankfully I've now moved 
on to gnucash.

Slight aside, any chance of changing the subject of this thread, or even 
ending the thread completely?  Why?  Every time I see it I picture 
Inspector Clouseau, "A BOM!!!" :)

-- 
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.

Mark Lawrence

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


Thread

Re: Guessing the encoding from a BOM Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-01-17 09:10 +0000

csiph-web