-urldecode = luci.http.protocol.urldecode
-urlencode = luci.http.protocol.urlencode
---[[
-function urldecode(str)
- str = str:gsub("+", " ")
- str = str:gsub("%%(%x%x)",
- function(h) return string.char(tonumber(h,16)) end)
- str = str:gsub("\r\n", "\n")
- return str
-end
-
-function urlencode(str)
- str = str:gsub("\n", "\r\n")
- str = str:gsub("([^%w ])",
- function (c) return string.format ("%%%02X", string.byte(c)) end)
- str = str:gsub(" ", "+")
- return str
-end
-]]--
\ No newline at end of file
+--- Return the URL-decoded equivalent of a string.
+-- @param str URL-encoded string
+-- @param no_plus Don't decode + to " "
+-- @return URL-decoded string
+-- @see urlencode
+urldecode = protocol.urldecode
+
+--- Return the URL-encoded equivalent of a string.
+-- @param str Source string
+-- @return URL-encoded string
+-- @see urldecode
+urlencode = protocol.urlencode