step-examples/12-1a-encoding/Le041.stp
Sources
- 16-iso-spec ISO 10303-21 Ed.3 §6.4.3
- Unicode standard §3.8 (surrogate code points are not legal scalars)
Description
`\Q\NNN\Q\` accepts decimal Unicode scalars, but values 55296.57343 (the UTF-16 surrogate halves) are not legal Unicode scalars; they exist only as paired surrogates in the UTF-16 transformation. A kernel that decodes `\Q\55296\Q\` into a UTF-8 stream produces an ill-formed sequence (CESU-8 / WTF-8 territory) that downstream tooling may reject. The producer may have meant a non-BMP character but failed to emit the surrogate pair, or may be re-encoding a Java/JavaScript string that allowed lone surrogates internally.
Reproducer recipe
`PRODUCT.name='lone=\Q\55296\Q\'` — value 55296 is U+D800, a high-surrogate half.
Expected kernel behavior
reject `\Q\.\Q\` payloads in the surrogate range (55296.57343); a tolerant mode may pass them through as a degraded encoding with a warning, but conforming Unicode output must not contain lone surrogates.
Notes
**See also**: Le044 (the matching `\X2\` defect). Synonyms: "Q directive encodes surrogate", "STEP Q with U+D800 lone surrogate", "surrogate half via Q escape", "ill-formed UTF-8 from Q surrogate", "WTF-8 from STEP Q escape".
Expected validation
occt=empty/empty gmsh=empty ifc=schema_n/a
Byte assertions
contains(b'\\Q\\55296\\Q\\')contains(b'55296')
Tier-3 assertions
shape_null == True
Cross-references
Live oracle output
No live oracle data — run _run_corpus to populate.
Fixture content
Show fixture bytes (with defect highlighting)
1ISO-10303-21; 2/* Le041: \Q\ encoding a code point in the UTF-16 surrogate range U+D800-U+DFFF; ISO 10303-21 Ed.3 §6.4.3: \Q\NNN\Q\ accepts decimal Unicode scalars; values 55296-57343 are UTF-16 surrogate halves, not legal Unicode scalars; defect string: 'lone=\Q\55296\Q\' â decimal 55296 = U+D800, high-surrogate half; a kernel decoding this into UTF-8 produces an ill-formed CESU-8 / WTF-8 sequence; the producer may have re-encoded a Java/JavaScript string that allowed lone surrogates internally, or failed to emit the surrogate pair for a supplementary-plane character; receiver must reject \Q\ payloads in the surrogate range 55296-57343 with a precise diagnostic; a tolerant mode may pass them through with a warning but must not emit conforming Unicode output containing lone surrogates; ifcopenshell observed to terminate via process signal on \Q\..\Q\ payloads; GEOMETRIC_CURVE_SET IS model entity â OCC yields empty */ 3HEADER; 4FILE_DESCRIPTION(('Le041'),'2;1'); 5FILE_NAME('Le041.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=GEOMETRIC_CURVE_SET('',(#1)); 11#8998=PERSON('lone=\Q\55296\Q\','q-ref-surrogate-U+D800',''); 12#8999=PERSON('low=\Q\57343\Q\','q-ref-surrogate-U+DFFF',''); 13 14ENDSEC; 15END-ISO-10303-21;