Re: [whatwg/url] percent-encode ' in queries of URLs with special schemes (#348)

I'm wondering why `'` is singled out here for "is special".

Referring to the new language that was added:

> byte is 0x27 (') and url is special

I tested query parsing for all ASCII characters in Chrome and Firefox:

Special URL:
```js
new URL("http://example.com/? !\"$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~").search
```

Chrome:
```
"?%20!%22$%&%27()*+,-./0123456789:;%3C=%3E?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~"
```

Firefox:
```
"?%20!%22$%&%27()*+,-./0123456789:;%3C=%3E?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~"
```

(Both encode <0x21, 0x22, 0x27, 0x3C, 0x3E, >0x7E — agreement with each other and spec.)

Non-special URL:
```js
new URL("ssh://example.com/? !\"$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~").search
```

Chrome:
```
"? !"$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~"
```

Firefox:
```
"?%20!"$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~"
```

Further experimentation shows that Chrome encodes <0x20 while Firefox encodes <0x21. No other ASCII characters are encoded.

So it seems that there's nothing special about `'` here; none of these characters are encoded for special URLs. So this could just read: "byte is 0x22 ("), 0x23 (#), 0x27 ('), 0x3C (<), or 0x3E (>) and url is special" and would be "more accurate".

(Having said all this, it looks like the path and other components are similarly not very well encoded for non-special URLs so there isn't much point fixing this for query unless it's fixed everywhere.)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/url/issues/348#issuecomment-401698162

Received on Monday, 2 July 2018 07:37:50 UTC