Golang text/template.HTMLEscape() function example
package text/template
Golang text/template.HTMLEscape() function usage example
package main
import (
"bytes"
"fmt"
"text/template"
)
func main() {
w := bytes.NewBufferString("")
b := []byte("<script>alert('xss attack!')</script>")
template.HTMLEscape(w, b)
fmt.Println(w)
}
References :
http://golang.org/pkg/text/template/#HTMLEscape
https://www.socketloop.com/references/golang-html-template-htmlescape-function-example
Advertisement
Something interesting
Tutorials
+9.6k Golang : How to generate Code 39 barcode?
+11.8k Golang : GTK Input dialog box examples
+11.5k Use systeminfo to find out installed Windows Hotfix(s) or updates
+15.2k Golang : Save(pipe) HTTP response into a file
+8.6k Golang : Progress bar with ∎ character
+13.6k Golang : Set image canvas or background to transparent
+9k Golang : Go as a script or running go with shebang/hashbang style
+5.2k Python : Create Whois client or function example
+10.2k Golang : Use regular expression to get all upper case or lower case characters example