Your file looks fine. Your parser disagrees.
The export opens in the editor with a normal first line. Run it through JSON or CSV and the first key or character fails. Compare two strings that should match and they do not. A colleague swears the files are identical. Somewhere at the start hides a UTF-8 byte order mark you never typed.
Strip BOM is a small Python library that removes that prefix from strings, bytes, streams, and files.
Three invisible bytes should not own your Monday.
What you get
- Clean text before parsers see it. Strip UTF-8 byte order mark from strings, bytes, streams, and files so structured data and string equality are not tripped by an invisible prefix.
- Buffers handled with a safety check. The buffer helper validates UTF-8 before it strips; invalid sequences are left unchanged so you do not silently corrupt binary-ish payloads.
- Large inputs without loading everything at once. Stream helpers process chunk by chunk so big files and streams stay memory efficient.
- Files in text or binary mode. Read a path and get back content with the BOM removed when it was there.
- Lightweight and free. No external dependencies; MIT licensed.
See what changes on one bad export
Picture an illustrative case: a partner drops a nightly CSV into shared storage. Your script reads the header row and every lookup on the first column fails because the column name carries an invisible prefix. The file helper reads the path, removes a leading UTF-8 byte order mark when present, and the header names line up with what your code expects. The same prefix that broke JSON from an API response or made two strings differ in tests is gone before your parser runs.






