encoding.bom
Byte Order Mark (BOM) at file start
AT rejects SAF-T files that start with a UTF-8 or UTF-16 BOM.
What is a BOM
A Byte Order Mark is a 2- or 3-byte signature at the very start of a text file that signals which Unicode encoding the file uses:
| Encoding | BOM bytes |
|---|---|
| UTF-8 | EF BB BF |
| UTF-16 BE | FE FF |
| UTF-16 LE | FF FE |
Why AT rejects BOMs
Windows-1252 has no BOM concept. The official SAF-T schema and AT's intake parser expect the first byte of the file to be the < of the XML prolog, not a Unicode signature.
When a BOM is present, the XML declaration parses but the file is rejected at intake without a useful error.
How a BOM gets there
- Saving from Notepad on Windows ("UTF-8 with BOM" is the default).
- Some ERPs prepend a BOM when exporting Unicode-aware XML.
- Manual file conversion through a tool that adds a signature.
How to fix
Remove the leading 2 or 3 bytes. The XML body otherwise stays unchanged.
# Linux/macOS one-liner for UTF-8 BOM
sed -i '1s/^\xEF\xBB\xBF//' my.xml
SAFTCheck strips the BOM automatically when you click "Auto-fix and download".
Detecting a BOM
Open the file in a hex editor. The first three bytes should be 3C 3F 78 (i.e. <?x), not EF BB BF.
Related
- XML encoding declaration (Windows-1252) — the broader encoding requirement.