luci-base: urlencode: encode all except unreserved characters.

As per http://tools.ietf.org/html/rfc3986#section-2.3

   Characters that are allowed in a URI but do not have a reserved
   purpose are called unreserved.  These include uppercase and lowercase
   letters, decimal digits, hyphen, period, underscore, and tilde.

      unreserved  = ALPHA / DIGIT / "-" / "." / "_" / "~"

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
pull/534/head
Yousong Zhou 2014-08-26 11:02:16 +08:00
parent 20851933bf
commit 20ccc90350
1 changed files with 1 additions and 1 deletions

View File

@ -72,7 +72,7 @@ function urlencode( str )
if type(str) == "string" then
str = str:gsub(
"([^a-zA-Z0-9$_%-%.!*'(),])",
"([^a-zA-Z0-9$_%-%.%~])",
__chrenc
)
end