Skip to main content
Version: 4.6.x.x LTS

Encoders

FunctionDescriptionSample
local Encoders = require "Encoders" Encoders.urlEncode(inputString)URL-encodes (percent-encoding) a string.function inputHeader(req, resp) req:setQuery(Encoders.urlEncode('X= Y+Z')) end
local Encoders = require "Encoders" Encoders.urlDecode(str)Decodes a percent-encoded string.Encoders.urlDecode("example.com?some%20params")
local Encoders = require "Encoders" Encoders.htmlEncodeEncodes (escapes) characters in an HTML string.Encoders.htmlEncode("<
local Encoders = require "Encoders" Encoders.htmlDecodeDecodes HTML entity references in a string.Encoders.htmlDecode("

0 < 1

")
local Encoders = require "Encoders" Encoders.codePointToUtf8(codePoint)Encodes a unicode code point into a UTF-8 byte sequence. The byte sequence is returned as a lua-string.local greekSigmaInUtf8 = Encoders.codePointToUtf8(0x3A3);