Sample code for 30+ languages & platforms
Lua Requires Chilkat v11.1.0+

HTML Encoding

Demonstrates HTML encoding and decoding.

Chilkat Lua Downloads

Lua
local chilkat = require("chilkat")

local crypt = chilkat.Crypt2.new()

local s = "< é ü ç Ω Hello & World ✓ >"

local htmlEncoded = crypt:encode_string(s, "utf-8", "html")
print(htmlEncoded)

-- Output:
-- < &eacute; &uuml; &ccedil; &ohm; Hello & World &check; >

-- To decode:
s = crypt:decode_string(htmlEncoded, "utf-8", "html")
print(s)

-- Output:
-- < é ü ç Ω Hello & World ✓ >