step-examples/12-1a-encoding/Le023.stp
Sources
- A038/numeric-parser pitfall
- N019/ISO 10303-21 Ed.3 REAL grammar
Description
The REAL grammar uses `.` only. A parser using `strtod` without `setlocale("C")` on a host with `LC_NUMERIC=de_DE` reads `1,5` as `1234`-style integers separated by a comma, or worse, two integer tokens. Producers using locale-aware `printf` on European locales emit `1,5` for one-and-a-half. Geometry then has wildly wrong coordinates; downstream tessellation can crash on degenerate triangles.
Reproducer recipe
`#1=CARTESIAN_POINT('',(1,5,0.,0.));`
Expected kernel behavior
use `strtod_l` with the `"C"` locale; reject anything `strtod` does not consume entirely. Tolerant readers should diagnose locale corruption rather than silently re-parse.
Notes
Synonyms: "European decimal comma in STEP REAL", "1,5 instead of 1.5 in attribute", "locale comma corrupts coordinates", "German locale STEP REAL parse fail", "decimal separator wrong in numeric".
Expected validation
occt=empty/empty gmsh=empty ifc=schema_n/a
Byte assertions
matches(rb"CARTESIAN_POINT\('[^']*',\([0-9]+,[0-9]+,")matches(rb'\(0,\s*0,\s*0,\s*0,\s*0\)')
Tier-3 assertions
shape_null == True
Live oracle output
No live oracle data — run _run_corpus to populate.
Fixture content
Show fixture bytes (with defect highlighting)
1ISO-10303-21; 2/* Le023: Locale-dependent decimal separator inside numeric attribute; ISO 10303-21 §6.4.4: REAL grammar uses '.' only as decimal separator; European locale (LC_NUMERIC=de_DE) printf emits '1,5' for one-and-a-half; parser using strtod without setlocale("C") reads comma-separated as separate tokens; CARTESIAN_POINT with commas instead of decimal points in coordinate list; wildly wrong coordinates â degenerate geometry downstream, possible tessellation crash; receiver must use strtod_l with C locale; reject anything strtod does not consume; GEOMETRIC_CURVE_SET IS model entity â OCC yields empty */ 3HEADER; 4FILE_DESCRIPTION(('Le023'),'2;1'); 5FILE_NAME('Le023.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#8997=CARTESIAN_POINT('',(1,5,0.,0.)); 12#8998=CARTESIAN_POINT('',(0,0,0,0,0)); 13 14ENDSEC; 15END-ISO-10303-21;