[whatwg/url] Encoding search params in application/x-www-form-urlencoded may not be compatible with mailto scheme (#573)

If you do
```javascript
let a = new URL('mailto:test@example.com?subject=Important%20business');
a.searchParams.set('body', 'hello');
console.log(a.href);
```
it would output `mailto:test@example.com?subject=Important+business&body=hello`, noticeably the whitespace `%20` is re-encoded as `+`.

While browsers all recognize this encoding, it may not be the case for other clients. The standard spec for `mailto` scheme ([RFC 6068](https://tools.ietf.org/html/rfc6068)), which Email clients generally follow, also doesn't mention `application/x-www-form-urlencoded` anywhere. So it might not be totally safe to do such encoding.

I'm not sure what's the right thing to do here. Probably one of:
* have RFC 6068 updated to account for `application/x-www-form-urlencoded`,
* make the encoding steps vary based on scheme, or at least
* add a notice that relying on the encoding may be wrong in some cases.

What do you think?

-- 
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/573

Received on Sunday, 17 January 2021 23:25:16 UTC