[New-bugs-announce] [issue36304] When using bz2 and lzma in mode 'wt', the BOM is not written

Gianluca report at bugs.python.org
Fri Mar 15 09:19:03 EDT 2019


New submission from Gianluca <gianluca.gippetto at gmail.com>:

When bz2 and lzma files are used in writing text mode (wrapped in a TextIOWrapper), the BOM of encodings such as utf-16 and utf-32 is not written. The gzip package works as expected (it writes the BOM).

The code that demonstrate this behavior (tested with Python 3.7) is attached here and can also be found on stackoverflow: https://stackoverflow.com/questions/55171439/python-bz2-and-lzma-in-mode-wt-dont-write-the-bom-while-gzip-does-why?noredirect=1#comment97103212_55171439

----------
components: IO
files: demonstrate_BOM_issue.py
messages: 337987
nosy: janluke
priority: normal
severity: normal
status: open
title: When using bz2 and lzma in mode 'wt', the BOM is not written
type: behavior
versions: Python 3.7
Added file: https://bugs.python.org/file48209/demonstrate_BOM_issue.py

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36304>
_______________________________________


More information about the New-bugs-announce mailing list