i noticed that html/template escapes a URI using small letters. For 
example, the following code outputs "%e5%af%bf%e5%8f%b8", not "
%E5%AF%BF%E5%8F%B8".

t, _ := template.New("foo").Parse(`{{define "T"}}<a 
href="/{{.}}"></a>{{end}}`)
t.ExecuteTemplate(os.Stdout, "T", "寿司")
(See https://play.golang.org/p/9caza-3ojur )

This behavior is different from what template.URLQueryEscaper does. Also, 
this is invalid with URL Standard ( 
https://url.spec.whatwg.org/#percent-encoded-bytes ). RFC 3986 Section 2.1 
<https://tools.ietf.org/html/rfc3986#section-2.1> says "For consistency, 
URI producers and normalizers should use uppercase hexadecimal digits for 
all percent-encodings."

It seems that this line 
<https://github.com/golang/go/blob/f4412aee749e9ca50e37427d169ce1a5543d7f6f/src/html/template/url.go#L137>
 generates 
these small letters. So we can fix this just by changing x to X.

But this behavior has remained for several years. Therefore I want to 
confirm that this should be fixed, before filing an issue or sending a pull 
req. Am I missing something?

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to