I’d like to use -[NSURL parameterString] to parse out the parameters of a URL I’ve been passed. It says URL must conform to RFC 1808 but now wondering if ours do?!? We use something like:
http://server/path/query?property1=value1&property2=value2
but RFC 1808 never mentions the ampersand (&) as a valid parameter separator (at least the way I read it). It suggests the semicolon (;). Perhaps because it was drafted in 1995? Has the & replaced the ;? If so anyone verify if NSURL’s parameterString will also parse with & as delimiter?
What’s the “right” way before we dig a big a hole?
According to RFC 1808 (2.1. URL Syntactic Components) correct syntax is as follows :
It says query information is formatted as per Section 3.3 of RFC 1738 which tells us :
“Within the path and searchpart components, “/”, “;”, “?” are reserved.”
To me the above says that in your URL the path (to your CGI) is :
and the query is :
Which does not contain any reserved characters. So you are OK. In fact the use of the “&” as a separator in the query string here derives from the CGI specification and not the URL RFC :
“Form data is a stream of name=value pairs separated by the & character.”