def utf8.decode

bend-kit-encoding@0.5.0.0 · encoding.bend:140

import bend-kit-encoding@0.5.0.0/encoding.bend as Encoding
import Base
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes

140# Octets to text, as WHATWG decodes UTF-8: malformed input becomes U+FFFD.
141def utf8.decode(b: Bytes.Bytes) -> String:
142  Bytes.Bytes{+len, buf} = b
143  utf8.decode.go(U32.to_nat(len), Bytes.peek(buf, 0), 0, Utf8{0, 128, 191, 0, SNil{}})

Uses (6)

Used by (23)