Logo Xantham

Wtf8 Module

The AST string table is WTF-8, not UTF-8: an unpaired UTF-16 surrogate is encoded as the three bytes `ED A0-BF 80-BF`, which strict UTF-8 rejects. `Encoding.UTF8.GetString` replaces those with U+FFFD, so identifiers and string literals carrying a lone surrogate come back silently corrupted. TypeScript permits them, so we decode them ourselves.

Functions and values

Function or value Description

Wtf8.decode bytes

Full Usage: Wtf8.decode bytes

Parameters:
Returns: string
bytes : ReadOnlySpan<byte>
Returns: string

Wtf8.decodeArray bytes

Full Usage: Wtf8.decodeArray bytes

Parameters:
    bytes : byte[]

Returns: string
bytes : byte[]
Returns: string

Type something to start searching.