Wr043 — Writer emits raw UTF-8 bytes in string literal where Ed.2 mandates `\X\` / `\X2\` escape

§12.13 writer-pathology (sub-class: encoding / escape directives)

silent-loss writer

Sources

Sender

Writers that rely on the host runtime's default UTF-8 string handling but emit `FILE_DESCRIPTION` with `'2;1'` implementation-level (Edition 2)

Description

A producer's writer emits non-ASCII characters as raw UTF-8 bytes (`\xC3\xA9` for `é`) inside a string literal, while the file's `FILE_DESCRIPTION` declares Edition-2 (`'2;1'`). Edition-2 mandates 8-bit default with non-ASCII expressed via `\X\HH`, `\X2\HHHH\X0\`, or `\PA\.\PI\` page-shift directives; raw multi-byte UTF-8 violates the edition's encoding contract. Edition-3 readers (UTF-8 default) decode the bytes correctly by accident; Edition-2 readers see two single-byte ISO-8859-1 characters instead of one composed `é`. The writer is the producer-side root cause for the receiver-side defect Le003 / Ad058. Bug-reporter language: "STEP writer outputs UTF-8 in Ed.2 file", "non-ASCII in Edition-2 STEP", "exporter does not escape non-ASCII".

Reproducer recipe

a `FILE_DESCRIPTION` `'2;1'` (Edition 2); a `PRODUCT.name` containing the raw bytes `\xC3\xA9` representing UTF-8 `é` instead of the spec-required `'\X\E9'` escape.

Expected kernel behavior

the writer detects the file's declared edition and emits non-ASCII characters via the edition-appropriate directive; Edition-2 uses `\X\` / `\X2\` / `\PA\.\PI\`; Edition-3 may emit raw UTF-8 with proper `FILE_DESCRIPTION` declaration. Never silently mismatch edition and encoding.

Notes

Producer-side root cause for Le003 (now merged into Le021), Le050, Ad058. **See also**: Le050, Le021. Provenance tier: requires-sibling-pair — bytes alone (this fixture's body) demonstrate the defect; the fuller demonstration is the differential between the in-memory string and the bytes the writer emits. **OCC behavior**: silently accepts (no diagnostic, empty result); catalog disallows silent-accept. Kernel-bug witnessed: receivers enforcing the spec must reject (or surface a diagnostic) — silent acceptance defeats the catalog's stated invariant.

Expected validation

occt=empty/empty gmsh=empty ifc=schema_n/a

Provenance tier

requires-sibling-pair — defect not fully embodied in fixture bytes.

Byte assertions

Tier-3 assertions

Cross-references

Le050, Le021

Live oracle output

No live oracle data — run _run_corpus to populate.

Fixture content

Show fixture bytes (with defect highlighting)
1ISO-10303-21;
2/* Wr043: writer emits raw UTF-8 bytes in string literal under Edition-2 declaration */
3/* FILE_DESCRIPTION declares '2;1' (Edition 2); Edition 2 mandates \X\HH escapes */
4/* DEFECT: PRODUCT.name contains raw UTF-8 bytes 0xC3 0xA9 (é) instead of '\X\E9' */
5/* Ed.2-strict readers see 0xC3=Ã and 0xA9=© (two ISO-8859-1 chars, mojibake) */
6HEADER;
7FILE_DESCRIPTION(('Wr043: raw UTF-8 bytes in Edition-2 string literal'),'2;1');
8FILE_NAME('Wr043.stp','2026-06-20T00:00:00',(''),(''),'cad-research-suite','','');
9FILE_SCHEMA(('AUTOMOTIVE_DESIGN { 1 0 10303 214 3 1 1 }'));
10ENDSEC;
11DATA;
12/* DEFECT: PRODUCT.name below contains raw UTF-8 bytes for é (0xC3 0xA9) */
13/* Spec-conformant Ed.2 form would be: 'caf\X\E9' */
14#1=CARTESIAN_POINT('origin',(0.,0.,0.));
15#2=CARTESIAN_POINT('corner',(1.,1.,0.));
16#3=DIRECTION('xdir',(1.,0.,0.));
17#4=DIRECTION('zdir',(0.,0.,1.));
18#5=PRODUCT('café','café-part','raw-utf8-in-ed2',(#6));
19#6=PRODUCT_CONTEXT('part',#7,'mechanical');
20#7=APPLICATION_CONTEXT('config design');
21#8=GEOMETRIC_CURVE_SET('raw-utf8-ed2-shape',(#1,#2));
22ENDSEC;
23END-ISO-10303-21;