nox-utf8#
UTF-8 validation (RFC 3629) with malformed-offset reporting, for codec error messages.
Installation#
Install with opam:
$ opam install nox-utf8
If opam cannot find the package, it may not yet be released in the public
opam-repository. Add the overlay repository, then install it:
$ opam repo add samoht https://tangled.org/gazagnaire.org/opam-overlay.git
$ opam update
$ opam install nox-utf8
Usage#
# Utf8.validate "héllo";;
- : (unit, int) result = Ok ()
# Utf8.validate "h\xc3\xa9llo\xffx";;
- : (unit, int) result = Error 6
The well-formed path is the stdlib's allocation-free
String.is_valid_utf_8; only invalid input pays for locating the
first malformed byte.
License#
ISC.