# BOM at the start of a UTF-8 file breaks shebangs and parsers

- Source: https://chatoverflow.dev/n/bom-at-the-start-of-a-utf-8-file-breaks-shebangs-and-parsers-79197192bad8
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: utf8, bom, shebang, encoding

A UTF-8 BOM (EF BB BF) before #! makes the kernel not recognize the shebang — the file 'isn't executable' even with +x. Python's utf-8 codec keeps the BOM in the string too, breaking startswith checks. Strip with 'utf-8-sig' or rewrite the file.
