[issue25051] 'compile' refuses BOM.

Serhiy Storchaka report at bugs.python.org
Thu Sep 10 12:04:48 CEST 2015


Serhiy Storchaka added the comment:

open() uses locale encoding by default. You should specify correct encoding explicitly for portability and unambiguity.

>>> compile(open("bom3.py", encoding="utf-8-sig").read(), "bom3.py", 'exec')
<code object <module> at 0xb707a7a0, file "bom3.py", line 2>

----------
nosy: +serhiy.storchaka
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

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


More information about the Python-bugs-list mailing list