IFClite TypeScript API
    Preparing search index...

    Function decodeIfcString

    • Decode IFC STEP encoded strings. Handles:

      • \X2\XXXX\X0\ - Unicode hex encoding (e.g., \X2\00E4\X0\ -> a with umlaut)
      • \X4\XXXXXXXX\X0\ - Unicode 4-byte hex for chars outside BMP
      • \X\XX\ - ISO-8859-1 hex encoding (NOT code-page dependent: this is always the ISO 10646 row-0 value, per ISO 10303-21 6.4.3)
      • \S\X - Extended ASCII: code point of X plus 128, mapped through the currently selected \P?\ code page (default ISO 8859-1)
      • \PA..\PI\ - Code page selectors (A=ISO 8859-1 .. I=ISO 8859-9); tracked for subsequent \S\ escapes, then the directive itself is dropped. Any other letter is dropped without changing the active page.
      • \ - one literal backslash (ISO 10303-21 doubles the reverse solidus)

      The \ pair is collapsed AFTER the directive arms: a directive immediately followed by an escaped backslash ends in three backslashes (\X2\00FC\X0\ + \), so collapsing pairs in a pre-pass would eat the directive's own terminator and leave an unterminated \X2.

      This handles only backslash escapes. The '' doubled-quote escape is collapsed by the STEP tokenizer's consumers (they strip surrounding quotes and un-double), so decoding must not touch quotes or it would double-collapse.

      Parameters

      • str: string

      Returns string