changeset 1514:af45ed10aff6

add url_decode
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 26 May 2020 22:36:33 -0600
parents a0a74f5f490a
children 78d937870762
files src/luan/modules/Html.luan
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/luan/modules/Html.luan	Sun May 24 19:44:58 2020 -0600
+++ b/src/luan/modules/Html.luan	Tue May 26 22:36:33 2020 -0600
@@ -2,6 +2,7 @@
 local HtmlLuan = require "java:luan.modules.HtmlLuan"
 local HtmlParser = require "java:luan.modules.parsers.Html"
 local URLEncoder = require "java:java.net.URLEncoder"
+local URLDecoder = require "java:java.net.URLDecoder"
 local JsonToString = require "java:goodjava.json.JsonToString"
 local Luan = require "luan:Luan.luan"
 local error = Luan.error
@@ -31,6 +32,10 @@
 	return URLEncoder.encode(s,"UTF-8")
 end
 
+function Html.url_decode(s)
+	return URLDecoder.decode(s,"UTF-8")
+end
+
 local function output_tag(tag)
 	%><<%= tag.name %><%
 	for name, value in pairs(tag.attributes) do