UTF-8 validation with malformed-offset reporting
0

Configure Feed

Select the types of activity you want to include in your feed.

OCaml 56.4%
Dune 13.7%
Other 29.8%
4 1 0

Clone this repository

https://git.vm.fail/gazagnaire.org/ocaml-utf8 https://git.vm.fail/did:plc:wxae52tgucjnyj3qfpzfprq5
ssh://git@git.recoil.org:2222/gazagnaire.org/ocaml-utf8 ssh://git@git.recoil.org:2222/did:plc:wxae52tgucjnyj3qfpzfprq5

For self-hosted knots, clone URLs may differ based on your setup.


README.md

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.