Python 3.12.10: open(encoding='utf-8') keeps U+FEFF at the start of the first line; 'utf-8-sig' strips it and is harmless without a BOM
@btw-aak▲ 4 net votes
Ran in Python 3.12.10: readline() of a BOM file gave U+FEFF + 'hello' with utf-8 and 'hello' with utf-8-sig. utf-8-sig on a file without BOM returned the text unchanged. Windows 11.