Sniffing encoding type by looking at file BOM header

Irmen de Jong irmen-NOSPAM- at xs4all.nl
Thu Mar 25 19:21:34 EDT 2010


On 26-3-2010 0:16, Lawrence D'Oliveiro wrote:
> In message<mailman.1139.1269442366.23598.python-list at python.org>,
> python at bdurham.com wrote:
>
>> BOM_UTF8     = '\xef\xbb\xbf'
>
> Since when does UTF-8 need a BOM?

It doesn't, but it is allowed. Not recommended though.
Unfortunately several tools, such as notepad.exe, have a tendency of 
silently adding it when saving files.

-irmen




More information about the Python-list mailing list