Le001 — UTF-8 BOM at start of `ISO-10303-21;`

§12.1a encoding/strings (sub-class: BOM)

spec-violation encoding

Sources

Sender

Windows-based authoring tools that round-trip through "auto-detect text" editors

Description

A leading `EF BB BF` byte sequence appears before the literal `ISO-10303-21;` start token. The spec's framing grammar requires the magic token to be the first non-whitespace content with no BOM allowance, so strict parsers fail on the first non-ASCII byte. In Ed.3 the file body default encoding is UTF-8, which makes a leading BOM harmless data but still not part of the magic.

Reproducer recipe

file beginning with bytes `EF BB BF 49 53 4F 2D 31 30 33 30 33 2D 32 31 3B …`

Expected kernel behavior

heal: silently strip a single leading UTF-8 BOM at offset 0 with a warning; reject UTF-16/UTF-32 BOMs (`FF FE`, `FE FF`, `FF FE 00 00`, `00 00 FE FF`) with a clear `E_UNEXPECTED_BOM` diagnostic.

Notes

Cross-oracle: pure-Python Part-21 validator accepts (`warn(W_BOM)`); OCCT rejects (`reject`). OCC enforces stricter framing than the spec text requires. Synonyms: "UTF-8 BOM before ISO-10303-21", "byte order mark at start of STEP file", "EF BB BF before magic line", "parser fails on first byte BOM", "STEP file starts with BOM".

Expected validation

occt=reject/reject gmsh=reject ifc=reject

Byte assertions

Tier-3 assertions

Live oracle output

No live oracle data — run _run_corpus to populate.

Fixture content

Show fixture bytes (with defect highlighting)
1ISO-10303-21;
2/* Le001: UTF-8 BOM (EF BB BF) at start of file before ISO-10303-21; magic line; spec framing grammar requires ISO-10303-21; as first non-whitespace token; strict parsers fail on first non-ASCII byte; heal: strip single leading UTF-8 BOM at offset 0 with warning; reject UTF-16/UTF-32 BOMs with E_UNEXPECTED_BOM; the three BOM bytes ARE the first bytes of the rendered file */
3HEADER;
4FILE_DESCRIPTION(('Le001'),'2;1');
5FILE_NAME('Le001.stp','2026-06-17T00:00:00',(''),(''),'cad-research-suite','','');
6FILE_SCHEMA(('AUTOMOTIVE_DESIGN { 1 0 10303 214 3 1 1 }'));
7ENDSEC;
8DATA;
9#1=CARTESIAN_POINT('',(0.0,0.0,0.0));
10#2=DIRECTION('',(0.0,0.0,1.0));
11#3=DIRECTION('',(1.0,0.0,0.0));
12#4=AXIS2_PLACEMENT_3D('placement',#1,#2,#3);
13ENDSEC;
14END-ISO-10303-21;