gizlang/encoding
Web text encodings. Labels and error recovery follow the WHATWG Encoding Standard.
import * as Encoding from "gizlang/encoding";Functions
encoding
function encoding(label: string): Option<string>The canonical encoding of a supported label, or none.
Effects: fail, alloc.
bom
function bom(data: bytes): Option<string>The encoding named by a byte order mark, or none.
Effects: fail.
decode
function decode(data: bytes, label: string = "utf-8", fatal: bool = false, ignoreBOM: bool = false): string throws stringDecode bytes of LABEL. Invalid sequences become U+FFFD, or throw with FATAL. A leading matching BOM is stripped unless IGNOREBOM is set, as TextDecoder specifies. An unsupported label throws.
Effects: fail, alloc.