Expand description
STEP string escape decoding/encoding (ISO 10303-21 / IFC).
IFC string attribute values encode non-ASCII characters with backslash
escape sequences. This module decodes them to native UTF-8 so the Rust
crates, CLI, and server surface the same text the browser parser does via
decodeIfcString in @ifc-lite/encoding. The two decoders are pinned to a
shared test-vector fixture (tests/fixtures/ifc_string_vectors.json).
Supported escapes:
\X2\HHHH..\X0\UTF-16 code units, 4 hex digits each (surrogate pairs ok)\X4\HHHHHHHH..\X0\Unicode scalar values, 8 hex digits each\X\HHsingle ISO-8859-1 byte\S\Cextended ASCII: code point ofCplus 128\PC\code-page directive, consumed and dropped
Unknown or malformed escapes are passed through unchanged. The ''
doubled-quote escape is NOT handled here — the tokenizer’s consumers strip
the surrounding quotes and un-double before calling this.
Functions§
- decode_
ifc_ string - Decode IFC STEP string escapes to UTF-8.
- encode_
ifc_ string - Encode a UTF-8 string back to IFC STEP escapes. Inverse of
decode_ifc_stringfor the canonical (non-overlong) forms; kept for STEP writers and round-trip tests.