|
@@ -0,0 +1,27 @@
|
|
|
+package web
|
|
|
+
|
|
|
+import (
|
|
|
+ "strings"
|
|
|
+)
|
|
|
+
|
|
|
+// HTMLUnEscape html special char convert
|
|
|
+// " to space, & to &, < to <, > to >
|
|
|
+func HTMLUnEscape(url string) string {
|
|
|
+ s := strings.Replace(url, """, "\"", -1)
|
|
|
+ s = strings.Replace(s, "&", "&", -1)
|
|
|
+ s = strings.Replace(s, "<", "<", -1)
|
|
|
+ s = strings.Replace(s, ">", ">", -1)
|
|
|
+
|
|
|
+ return s
|
|
|
+}
|
|
|
+
|
|
|
+// HTMLEscape html special char convert
|
|
|
+// space to ", & to &, < to <, > to >
|
|
|
+func HTMLEscape(url string) string {
|
|
|
+ s := strings.Replace(url, "\"", """, -1)
|
|
|
+ s = strings.Replace(s, "&", "&", -1)
|
|
|
+ s = strings.Replace(s, "<", "<", -1)
|
|
|
+ s = strings.Replace(s, ">", ">", -1)
|
|
|
+
|
|
|
+ return s
|
|
|
+}
|