eryksun added the comment:

Yes, if you explicitly use big-ending or little-endian UTF, then you need to 
manually include a BOM if that's required. That said, if a file format or data 
field is specified with a particular byte order, then using a BOM is strictly 
incorrect. See the UTF BOM FAQ:

    http://www.unicode.org/faq/utf_bom.html#BOM

For regular text documents, in which the byte order doesn't really matter, use 
the native byte order of your platform via UTF-16 or UTF-32. Also, instead of 
manually encoding strings, use the "encoding" parameter of the built-in open 
function, or io.open or codecs.open in Python 2. This only writes a single BOM, 
even when writing to a file multiple times.

----------
nosy: +eryksun
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25325>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to