acid.utf8
This library is considered production ready.
This library provides basic support for UTF-8 encoding.
local utf8 = require('acid.utf8')
local utf8_str, err, errmsg = utf8.char({258, 0x1234})
if err ~= nil then
ngx.say('error')
end
local code_points, err, errmsg = utf8.code_point(utf8_str)
if err ~= nil then
ngx.say('error')
end
syntax:
utf8_str, err, errmsg = utf8.char(code_points)
Converts each code point to its corresponding UTF-8 byte sequence and returns a string with the concatenation of all these sequences.
arguments:
code_points
: A table contains code points.
return: A string with the concatenation of all UTF-8 sequences.
syntax:
code_points, err, errmsg = utf8.code_point(utf8_str)
Returns the code points (as integers) from all characters in utf8_str.
arguments:
utf8_str
: A utf8 encoded string.
return: A table contains code points.
Renzhi (任稚) [email protected]
The MIT License (MIT)
Copyright (c) 2015 Renzhi (任稚) [email protected]