std.utf.valid

std.utf

valid(str) -> ok, pos

Validate that a string is well-formed UTF-8

Returns true if the entire string is valid UTF-8. On the first invalid byte, returns false and the byte position of the error.