lights FAQ Forum github.com/luapower/terra.utf8
This package
terra.utf8

Terra Standard Libraries
terra.low
terra.arrayview
terra.dynarray
terra.hashmap
terra.phf
terra.linkedlist
terra.fixedfreelist
terra.arrayfreelist
terra.lrucache
terra.bitarray
terra.utf8
terra.random

terra.utf8

UTF-8 encoding and decoding in Terra


--[[

	UTF-8 encoding and decoding in Terra.
	Written by Cosmin Apreutesei. Public Domain.

	NOTE: An unfinished sequence gets replaced with a single codepoint.
	NOTE: An invalid byte gets replaced with one codepoint.

	utf8.decode.count    (s,len,    outlen,on_reject,repl_c) -> n, i, q
	utf8.decode.tobuffer (s,len,out,outlen,on_reject,repl_c) -> n, i, q
	utf8.decode.toarr    (s,len,out,outlen,on_reject,repl_c) -> n, i, q

	for valid,i,c in utf8.decode.codepoints(s,len) do ... end

	utf8.encode.count    (s,len,    outlen,on_reject,repl_c) -> n, i, q
	utf8.encode.tobuffer (s,len,out,outlen,on_reject,repl_c) -> n, i, q
	utf8.encode.toarr    (s,len,out,outlen,on_reject,repl_c) -> n, i, q

	on_reject : utf8.REPLACE | utf8.KEEP | utf8.SKIP | utf8.STOP
	repl_c    : utf8.INVALID | any-codepoint

]]

See the source code for more info.


Package:terra.utf8
Pkg type:Terra
Version: f858394
Last commit:
Author: Cosmin Apreutesei
License: Public Domain
Requires: +terra.arrayview  +terra.dynarray  +terra.low  +glue  +luajit  +pp 
Required by: none

Top