def utf8.lead

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

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

93# WHATWG: a byte that cannot start a sequence decodes to U+FFFD.
94def utf8.lead(+b: U32, out: String, ascii: Bool) -> Utf8:
95  match ascii:
96    case True{}:
97      Utf8{0, 128, 191, 0, SCon{Chr{b}, out}}
98    case False{}:
99      utf8.lead.high(b, out, Bool.or(U32.is_lt(b, 194), U32.is_lt(244, b)))

Uses (8)

Used by (2)