print UTF-8 file with BOM

Walter Dörwald walter at livinglogic.de
Fri Dec 23 17:19:49 CET 2005


John Bauman wrote:

> UTF-8 shouldn't need a BOM, as it is designed for character streams, and 
> there is only one logical ordering of the bytes. Only UTF-16 and greater 
> should output a BOM, AFAIK. 

However there's a pending patch (http://bugs.python.org/1177307) for a 
new encoding named utf-8-sig, that would output a leading BOM on writing 
and skip it on reading.

Bye,
    Walter Dörwald



More information about the Python-list mailing list