Module:Sandbox/Luis150902/cleanup

-- This module escapes Unicode characters >= U+0100.

local p = {}

function p._main(s) local r = "" local i = 1 local l = mw.ustring.len(s) local e = "" while i <= l do	 if mw.ustring.codepoint(s, i) >= 256 then e = mw.ustring.format("&#x%04x;", mw.ustring.codepoint(s, i)) else e = mw.ustring.sub(s, i, i + 1) end r = r .. e	 i = i + 1 end return r end

function p.main(frame) return p._main(frame.args[1]) end

return p