I create html using html/template However, in the case of the href attribute of the a tag, reserved character escaped by html/template
I know that reserved characters are not escaped by rfc 3986 How to not escape reserved characters in href attribute?
for example…
dict := make(map[string]interface{})
dict["link"] = `https://example.com/()"`
tag := `<a href="{{ $.link }}"></a>`
t, _ := template.New("tag").Parse(tag)
var tpl bytes.Buffer
e := t.Execute(&tpl, dict)
if e != nil {
fmt.Println(e)
}
fmt.Println(tpl.String())
// <a href="https://example.com/%28%29%22"></a>
my expecting
// <a href="https://example.com/()"></a>