Re: [whatwg/url] Introduce a variant of url.searchParams that operates according to URL rules instead of <form> rules (#491)

I agree; `&` and `=` are the default delimiters, and the vast majority of developers will never need to change them (or create a custom schema at all; they can use the built-in ones for form-encoding or percent-encoding). But I do think it has some small amount of value - `;` (semicolon) can be used sometimes as a delimiter between pairs, and I've seen applications which try all sorts of more exotic things. The `spotify:` URL scheme actually uses the same delimiter between keys and values as it does between key-value pairs!

```
spotify:user:<username>:playlist:<id> 
spotify:search:<text>
```

The [NodeJS `querystring`](https://nodejs.org/api/querystring.html) API also has `parse` and `stringify` methods that allow specifying a custom delimiter.

If you _did_ need to parse/create an existing URL format which uses a different delimiter, it is not entirely trivial to do, and I think it's the kind of thing a URL API could and probably should help you do correctly. Even if we also advise that most users stick with the default.

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

Message ID: <whatwg/url/issues/491/1302221798@github.com>

Received on Thursday, 3 November 2022 14:44:52 UTC