I expect my link in the href tag to look like http://goolge.com/?q=hellow+world instead of http://goolge.com/?q=hellow+world. Both template.HTML and template.HTMLEscapeString seem to do the same thing. In fact, we risk double escaping with the latter if you add something like http://google.com/?q=hello+world&bar=eek which will result in http://google.com/?q=hello+world&bar=eek
Thanks @radovskyb. I did look at that question initially and was convinced by your answer. It works on most browsers, but not necessarily in all HTML Rendering mail clients Which is mainly the use case in our team.
Apart from using url.QueryUnescape(string) (string, error) as a work around before passing the string to the template, do you think there a simpler/cleaner solution?
Ah ok, I see. Well in that case, I would probably go with using html.UnescapeString, not url.QueryUnescape, especially since for the above example, url.QueryUnescape won’t even turn the + back into a +.