add-bom
A simple command-line utility to add a UTF-8 BOM (Byte Order Mark) to files. This is particularly useful for CSV files that need to be opened correctly in Excel on macOS, where files without a BOM might be interpreted with incorrect character encoding.
Installation
The recommended way to install this tool is using pipx:
pipx install add-bom
Usage
add-bom <file>
Options
--force: Force add BOM to file regardless of current encoding
Examples
Add BOM to a UTF-8 CSV file:
add-bom data.csv
Force add BOM to a file (use with caution):
add-bom data.csv --force
What is a BOM?
A BOM (Byte Order Mark) is a special character sequence at the beginning of a text file that indicates the encoding of the file. For UTF-8 files, the BOM is the sequence EF BB BF in hexadecimal.
Why is this needed?
When opening CSV files in Excel on macOS, files without a BOM might be interpreted with incorrect character encoding (like MacRoman or Windows-1252), leading to garbled text. Adding a UTF-8 BOM ensures that Excel correctly recognizes the file as UTF-8 encoded.
Safety Features
The tool includes several safety checks:
- Verifies the file exists
- Checks if the file already has a BOM
- By default, only adds BOM to files that are already UTF-8 encoded
- Requires
--forceflag to add BOM to files with other encodings
License
MIT License - See LICENSE file for details
Metadata
Release files for add-bom 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| add_bom-1.0.0.tar.gz | 2.7 kB | Without provenance | Details for add_bom-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| add_bom-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for add_bom-1.0.0-py3-none-any.whl |
Total release size: 6.5 kB
Release files / add_bom-1.0.0.tar.gz
| Download URL | add_bom-1.0.0.tar.gz |
|---|---|
| Size | 2.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
03d5d702624c0779b0ad952b9ee9eaf509d91811a2de7a3fceca8a5491bbe648
|
|
BLAKE2b-256 checksum How to use checksums |
a0e01ef6cebf0ec264ed4555f0e586578e55d9b42bea160feae045ead294f628
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.2 CPython/3.10.6 Darwin/24.4.0
|
Release files / add_bom-1.0.0-py3-none-any.whl
| Download URL | add_bom-1.0.0-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d95e2f43269fbf1ff0acdb0b9f6741805730a63d54a90e991651544f8b71ab2e
|
|
BLAKE2b-256 checksum How to use checksums |
7bfa1850fead751c5f46c71fc66a537e6e3b9d57430ef00927ee9c956d34a2b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.2 CPython/3.10.6 Darwin/24.4.0
|
Security for add-bom 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.