3 ms·
My recollection of the "old days" may be a bit hazy, but I think comma delimited parameters were a work around for frameworks that did not support multiple valu
by throwaway062o 3y ago
My recollection of the "old days" may be a bit hazy, but I think comma delimited parameters were a work around for frameworks that did not support multiple values (or users not knowing how to handle it)
Example of a "correct" url
?value=A&value=B&value=C
Complete frameworks would have a method that returned the values as a list. Some like PHP required ugly work arounds where you had to name the parameter using the array syntax: value[]=A&value[]=B&value[]=C
Even if the framework supported multi-values, many preferred the shorter version: value=A,B,C and split the values in code instead
- rvnx 3y agovalue[]=A&value[]=B&value[]=C is an idea that apparently came out of PHP in ~2000, not of standards. So, people who learnt programming in 2000, until ~2010 it's quite normal to see the commas as delimiter of multiple parameters.
- recursive 3y agoAs far as I know, the "standard" way is value=A&value=B&value=C. This is what comes out of a plain form submission.
- simonw 3y agoDjango actually has a special mechanism for dealing with ?value=&A&value=B values = request.GET.getlist("value") # values is now ["A", "B"] We built it that way because we had seen the weird bugs that cropped up with the PHP solution, where passing ?q[]=x to a PHP application that expected ?q=x could result in an array passed to code that expected a string.
- AlienRobot 3y agoI don't know if it's something from the old days or not, but iirc URLs have a semicolon separator (;) that would go before the ?. I have never seen it being used. I'm betting it's even less support than commas!
- toast0 3y agoMy understanding is you can use ; instead of both ? And & Handy if anything actually supported it, because then you could plop parameters on the end of urls without looking to see if there was already a ? I'm sure it's used somewhere, but I can only remember it being used by Yahoo Link Tracking ;_ylt=y64encodedgunk
- recursive 3y agoSemicolon (;) has no special meaning in a URL. You can ascribe it a meaning in your particular routing, but the spec has nothing to say about it. https://url.spec.whatwg.org/ https://url.spec.whatwg.org/
- uranusjr 3y agoIn the OG RFC 2396, each _path segment_ can specify parameters similar to query parameters, but using a semicolon to separate them to the main segment value instead of question mark. This has effects e.g. when calculating relative URLs. This is now obsolete, but many URL-parsing libraries have an API for that for compatibility.
- felixfbecker 3y agoThe issue is that commas are technically not allowed in the search params without being percent encoded