@@ -18,7 +18,7 @@ func TestTypedContent(t *testing.T) {
18
18
HTML (`Hello, <b>World</b> &tc!` ),
19
19
HTMLAttr (` dir="ltr"` ),
20
20
JS (`c && alert("Hello, World!");` ),
21
- JSStr (`Hello, World & O'Reilly\x21 ` ),
21
+ JSStr (`Hello, World & O'Reilly\u0021 ` ),
22
22
URL (`greeting=H%69,&addressee=(World)` ),
23
23
Srcset (`greeting=H%69,&addressee=(World) 2x, https://golang.org/favicon.ico 500.5w` ),
24
24
URL (`,foo/,` ),
@@ -70,7 +70,7 @@ func TestTypedContent(t *testing.T) {
70
70
`Hello, <b>World</b> &tc!` ,
71
71
` dir="ltr"` ,
72
72
`c && alert("Hello, World!");` ,
73
- `Hello, World & O'Reilly\x21 ` ,
73
+ `Hello, World & O'Reilly\u0021 ` ,
74
74
`greeting=H%69,&addressee=(World)` ,
75
75
`greeting=H%69,&addressee=(World) 2x, https://golang.org/favicon.ico 500.5w` ,
76
76
`,foo/,` ,
@@ -100,7 +100,7 @@ func TestTypedContent(t *testing.T) {
100
100
`Hello, World &tc!` ,
101
101
` dir="ltr"` ,
102
102
`c && alert("Hello, World!");` ,
103
- `Hello, World & O'Reilly\x21 ` ,
103
+ `Hello, World & O'Reilly\u0021 ` ,
104
104
`greeting=H%69,&addressee=(World)` ,
105
105
`greeting=H%69,&addressee=(World) 2x, https://golang.org/favicon.ico 500.5w` ,
106
106
`,foo/,` ,
@@ -115,7 +115,7 @@ func TestTypedContent(t *testing.T) {
115
115
`Hello, World &tc!` ,
116
116
` dir="ltr"` ,
117
117
`c && alert("Hello, World!");` ,
118
- `Hello, World & O'Reilly\x21 ` ,
118
+ `Hello, World & O'Reilly\u0021 ` ,
119
119
`greeting=H%69,&addressee=(World)` ,
120
120
`greeting=H%69,&addressee=(World) 2x, https://golang.org/favicon.ico 500.5w` ,
121
121
`,foo/,` ,
@@ -130,7 +130,7 @@ func TestTypedContent(t *testing.T) {
130
130
`Hello, <b>World</b> &tc!` ,
131
131
` dir="ltr"` ,
132
132
`c && alert("Hello, World!");` ,
133
- `Hello, World & O'Reilly\x21 ` ,
133
+ `Hello, World & O'Reilly\u0021 ` ,
134
134
`greeting=H%69,&addressee=(World)` ,
135
135
`greeting=H%69,&addressee=(World) 2x, https://golang.org/favicon.ico 500.5w` ,
136
136
`,foo/,` ,
@@ -146,7 +146,7 @@ func TestTypedContent(t *testing.T) {
146
146
// Not escaped.
147
147
`c && alert("Hello, World!");` ,
148
148
// Escape sequence not over-escaped.
149
- `"Hello, World & O'Reilly\x21 "` ,
149
+ `"Hello, World & O'Reilly\u0021 "` ,
150
150
`"greeting=H%69,\u0026addressee=(World)"` ,
151
151
`"greeting=H%69,\u0026addressee=(World) 2x, https://golang.org/favicon.ico 500.5w"` ,
152
152
`",foo/,"` ,
@@ -162,7 +162,7 @@ func TestTypedContent(t *testing.T) {
162
162
// Not JS escaped but HTML escaped.
163
163
`c && alert("Hello, World!");` ,
164
164
// Escape sequence not over-escaped.
165
- `"Hello, World & O'Reilly\x21 "` ,
165
+ `"Hello, World & O'Reilly\u0021 "` ,
166
166
`"greeting=H%69,\u0026addressee=(World)"` ,
167
167
`"greeting=H%69,\u0026addressee=(World) 2x, https://golang.org/favicon.ico 500.5w"` ,
168
168
`",foo/,"` ,
@@ -171,30 +171,30 @@ func TestTypedContent(t *testing.T) {
171
171
{
172
172
`<script>alert("{{.}}")</script>` ,
173
173
[]string {
174
- `\x3cb\x3e \x22foo%\x22 O\x27Reilly \x26bar ;` ,
175
- `a[href =~ \x22 \/\/example.com\x22 ]#foo` ,
176
- `Hello, \x3cb\x3eWorld\x3c \/b\x3e \x26amp ;tc!` ,
177
- ` dir=\x22ltr\x22 ` ,
178
- `c \x26\x26 alert(\x22Hello , World!\x22 );` ,
174
+ `\u003cb\u003e \u0022foo%\u0022 O\u0027Reilly \u0026bar ;` ,
175
+ `a[href =~ \u0022 \/\/example.com\u0022 ]#foo` ,
176
+ `Hello, \u003cb\u003eWorld\u003c \/b\u003e \u0026amp ;tc!` ,
177
+ ` dir=\u0022ltr\u0022 ` ,
178
+ `c \u0026\u0026 alert(\u0022Hello , World!\u0022 );` ,
179
179
// Escape sequence not over-escaped.
180
- `Hello, World \x26 O\x27Reilly\x21 ` ,
181
- `greeting=H%69,\x26addressee =(World)` ,
182
- `greeting=H%69,\x26addressee =(World) 2x, https:\/\/golang.org\/favicon.ico 500.5w` ,
180
+ `Hello, World \u0026 O\u0027Reilly\u0021 ` ,
181
+ `greeting=H%69,\u0026addressee =(World)` ,
182
+ `greeting=H%69,\u0026addressee =(World) 2x, https:\/\/golang.org\/favicon.ico 500.5w` ,
183
183
`,foo\/,` ,
184
184
},
185
185
},
186
186
{
187
187
`<script type="text/javascript">alert("{{.}}")</script>` ,
188
188
[]string {
189
- `\x3cb\x3e \x22foo%\x22 O\x27Reilly \x26bar ;` ,
190
- `a[href =~ \x22 \/\/example.com\x22 ]#foo` ,
191
- `Hello, \x3cb\x3eWorld\x3c \/b\x3e \x26amp ;tc!` ,
192
- ` dir=\x22ltr\x22 ` ,
193
- `c \x26\x26 alert(\x22Hello , World!\x22 );` ,
189
+ `\u003cb\u003e \u0022foo%\u0022 O\u0027Reilly \u0026bar ;` ,
190
+ `a[href =~ \u0022 \/\/example.com\u0022 ]#foo` ,
191
+ `Hello, \u003cb\u003eWorld\u003c \/b\u003e \u0026amp ;tc!` ,
192
+ ` dir=\u0022ltr\u0022 ` ,
193
+ `c \u0026\u0026 alert(\u0022Hello , World!\u0022 );` ,
194
194
// Escape sequence not over-escaped.
195
- `Hello, World \x26 O\x27Reilly\x21 ` ,
196
- `greeting=H%69,\x26addressee =(World)` ,
197
- `greeting=H%69,\x26addressee =(World) 2x, https:\/\/golang.org\/favicon.ico 500.5w` ,
195
+ `Hello, World \u0026 O\u0027Reilly\u0021 ` ,
196
+ `greeting=H%69,\u0026addressee =(World)` ,
197
+ `greeting=H%69,\u0026addressee =(World) 2x, https:\/\/golang.org\/favicon.ico 500.5w` ,
198
198
`,foo\/,` ,
199
199
},
200
200
},
@@ -208,7 +208,7 @@ func TestTypedContent(t *testing.T) {
208
208
// Not escaped.
209
209
`c && alert("Hello, World!");` ,
210
210
// Escape sequence not over-escaped.
211
- `"Hello, World & O'Reilly\x21 "` ,
211
+ `"Hello, World & O'Reilly\u0021 "` ,
212
212
`"greeting=H%69,\u0026addressee=(World)"` ,
213
213
`"greeting=H%69,\u0026addressee=(World) 2x, https://golang.org/favicon.ico 500.5w"` ,
214
214
`",foo/,"` ,
@@ -224,7 +224,7 @@ func TestTypedContent(t *testing.T) {
224
224
`Hello, <b>World</b> &tc!` ,
225
225
` dir="ltr"` ,
226
226
`c && alert("Hello, World!");` ,
227
- `Hello, World & O'Reilly\x21 ` ,
227
+ `Hello, World & O'Reilly\u0021 ` ,
228
228
`greeting=H%69,&addressee=(World)` ,
229
229
`greeting=H%69,&addressee=(World) 2x, https://golang.org/favicon.ico 500.5w` ,
230
230
`,foo/,` ,
@@ -233,15 +233,15 @@ func TestTypedContent(t *testing.T) {
233
233
{
234
234
`<button onclick='alert("{{.}}")'>` ,
235
235
[]string {
236
- `\x3cb\x3e \x22foo%\x22 O\x27Reilly \x26bar ;` ,
237
- `a[href =~ \x22 \/\/example.com\x22 ]#foo` ,
238
- `Hello, \x3cb\x3eWorld\x3c \/b\x3e \x26amp ;tc!` ,
239
- ` dir=\x22ltr\x22 ` ,
240
- `c \x26\x26 alert(\x22Hello , World!\x22 );` ,
236
+ `\u003cb\u003e \u0022foo%\u0022 O\u0027Reilly \u0026bar ;` ,
237
+ `a[href =~ \u0022 \/\/example.com\u0022 ]#foo` ,
238
+ `Hello, \u003cb\u003eWorld\u003c \/b\u003e \u0026amp ;tc!` ,
239
+ ` dir=\u0022ltr\u0022 ` ,
240
+ `c \u0026\u0026 alert(\u0022Hello , World!\u0022 );` ,
241
241
// Escape sequence not over-escaped.
242
- `Hello, World \x26 O\x27Reilly\x21 ` ,
243
- `greeting=H%69,\x26addressee =(World)` ,
244
- `greeting=H%69,\x26addressee =(World) 2x, https:\/\/golang.org\/favicon.ico 500.5w` ,
242
+ `Hello, World \u0026 O\u0027Reilly\u0021 ` ,
243
+ `greeting=H%69,\u0026addressee =(World)` ,
244
+ `greeting=H%69,\u0026addressee =(World) 2x, https:\/\/golang.org\/favicon.ico 500.5w` ,
245
245
`,foo\/,` ,
246
246
},
247
247
},
@@ -253,7 +253,7 @@ func TestTypedContent(t *testing.T) {
253
253
`Hello%2c%20%3cb%3eWorld%3c%2fb%3e%20%26amp%3btc%21` ,
254
254
`%20dir%3d%22ltr%22` ,
255
255
`c%20%26%26%20alert%28%22Hello%2c%20World%21%22%29%3b` ,
256
- `Hello%2c%20World%20%26%20O%27Reilly%5cx21 ` ,
256
+ `Hello%2c%20World%20%26%20O%27Reilly%5cu0021 ` ,
257
257
// Quotes and parens are escaped but %69 is not over-escaped. HTML escaping is done.
258
258
`greeting=H%69,&addressee=%28World%29` ,
259
259
`greeting%3dH%2569%2c%26addressee%3d%28World%29%202x%2c%20https%3a%2f%2fgolang.org%2ffavicon.ico%20500.5w` ,
@@ -268,7 +268,7 @@ func TestTypedContent(t *testing.T) {
268
268
`Hello%2c%20%3cb%3eWorld%3c%2fb%3e%20%26amp%3btc%21` ,
269
269
`%20dir%3d%22ltr%22` ,
270
270
`c%20%26%26%20alert%28%22Hello%2c%20World%21%22%29%3b` ,
271
- `Hello%2c%20World%20%26%20O%27Reilly%5cx21 ` ,
271
+ `Hello%2c%20World%20%26%20O%27Reilly%5cu0021 ` ,
272
272
// Quotes and parens are escaped but %69 is not over-escaped. HTML escaping is not done.
273
273
`greeting=H%69,&addressee=%28World%29` ,
274
274
`greeting%3dH%2569%2c%26addressee%3d%28World%29%202x%2c%20https%3a%2f%2fgolang.org%2ffavicon.ico%20500.5w` ,
0 commit comments