Golang html.UnescapeString function example
package html
UnescapeString unescapes entities like "<" to become "<". It unescapes a larger range of entities than EscapeString escapes. For example, "á" unescapes to "á", as does "á" and "&xE1;". UnescapeString(EscapeString(s)) == s always holds, but the converse isn't always true.
Golang html.UnescapeString function usage example
package main
import (
"fmt"
"html"
)
func main() {
s := "<script>alert('xss')</script>"
fmt.Println(html.UnescapeString(s))
}
Output :
Reference :
Advertisement
Something interesting
Tutorials
+16.6k Golang : Merge video(OpenCV) and audio(PortAudio) into a mp4 file
+11.1k Golang : Fix go.exe is not compatible with the version of Windows you're running
+5.4k Javascript : How to loop over and parse JSON data?
+13.1k Golang : List objects in AWS S3 bucket
+28.2k Golang : Connect to database (MySQL/MariaDB) server
+5.9k Golang : Generate multiplication table from an integer example
+14.5k How to automatically restart your crashed Golang server
+32.5k Golang : Copy directory - including sub-directories and files
+20.8k Golang : Underscore or snake_case to camel case example
+11.5k Golang : Format numbers to nearest thousands such as kilos millions billions and trillions
+11.9k Golang : How to parse plain email text and process email header?