UnescapeString in Go

Posted by GoDoc
Public (Editable by Users)

UnescapeString unescapes entities like "<" to become "<". It unescapes a larger range of entities than EscapeString escapes. For example, "á" unescapes to "á", as does "á" and "á". UnescapeString(EscapeString(s)) == s always holds, but the converse isn't always true.

Go
Edit
package main

import (
	"fmt"
	"html"
)

func main() {
	const s = `&quot;Fran &amp; Freddie&#39;s Diner&quot; &lt;tasty@example.com&gt;`
	fmt.Println(html.UnescapeString(s))
}