[issue25325] UTF-16LE, UTF-16BE, UTF-32LE, and UTF-32BE encodings don't add/remove BOM on encode/decode

R. David Murray report at bugs.python.org
Tue Oct 6 14:14:50 EDT 2015


R. David Murray added the comment:

eryksun beat me to the answer, but I'm going to post mine anyway :)

If I understand the codecs docs correctly, this is because if you are specifying the endianess you want, it is a sign that you are only going to interpret it as that endianness, so there's no need for a BOM.  If you want a BOM, use utf-16/32.

In short, what is your use case for producing a UTF string with non-native byte order?  But as eryksun said, the Python supported way to do that and include a BOM is to write the BOM yourself.

----------
nosy: +lemburg, r.david.murray -eryksun
resolution: not a bug -> 
stage: resolved -> 
status: closed -> open

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25325>
_______________________________________


More information about the Python-bugs-list mailing list