///|
fn decode_string(
bytes : BytesView,
table : String,
index : Int32,
charset : String?,
) -> String raise MoError {
if charset is None {
for byte in bytes {
if byte >= 0x80 {
raise UnsupportedCharset(
declared="unspecified (non-ASCII bytes present)",
)
}
}
}
@utf8.decode(bytes) catch {
Malformed(tail) =>
raise InvalidUtf8(
table~,
index~,
byte_offset=tail.start_offset() - bytes.start_offset(),
)
}
}