Skip to main content

decode_fatal

Function decode_fatal 

Source
pub fn decode_fatal(bytes: &[u8]) -> Option<&str>
Expand description

What: Decode record bytes the way a fatal TextDecoder does: valid UTF-8 only, with one leading byte-order mark removed. Why: The incumbent decodes owner and journal records with new TextDecoder('utf-8', { fatal: true }), which rejects invalid bytes and drops a leading mark.

In TS you’d write (pseudocode):

new TextDecoder('utf-8', { fatal: true }).decode(bytes)