Golang text/template.HTMLEscapeString() function example
package text/template
Golang text/template.HTMLEscapeString() function usage example.
package main
import (
"fmt"
"text/template"
)
func main() {
s := "<script>alert('xss attack!')</script>"
final := template.HTMLEscapeString(s)
fmt.Println(final)
}
Reference :
Advertisement
Something interesting
Tutorials
+11.7k Golang : Gorilla web tool kit secure cookie example
+7.2k Ubuntu : connect() to unix:/var/run/php5-fpm.sock failed (13: Permission denied) while connecting to upstream
+14.6k Golang : Execute function at intervals or after some delay
+26k Golang : Convert IP address string to long ( unsigned 32-bit integer )
+7.2k Golang : Check if one string(rune) is permutation of another string(rune)
+29.3k Golang : Save map/struct to JSON or XML file
+19.3k Golang : Calculate entire request body length during run time
+7.9k Golang Hello World Example
+17.7k How to enable MariaDB/MySQL logs ?
+10.4k Golang : Simple Jawi(Yawi) to Rumi(Latin/Romanize) converter
+13.4k Golang : Read from buffered reader until specific number of bytes
+52.6k Golang : How to get struct field and value by name