On the use of %20 instead of + in URIs
Adnan Maolood
me at adnano.co
Fri Nov 27 16:20:31 GMT 2020
On Fri Nov 27, 2020 at 6:37 AM EST, James Tomasino wrote:
> On 11/27/20 11:10 AM, Philip Linde wrote:
> > "+" doesn't generally have a special meaning that implies synonymity
> > with spaces. The sentence you're referring to should be considered a
> > clarifying point (because it's an easy mistake to make I guess), not a
> > difference from the standard it adopts (RFC 3986)
>
> Philip is correct, but to add on, the '+' specifically has a semantic
> meaning as a space in query strings and form encodings
> (application/x-www-form-urlencoded) according to RFC 1866, but NOT in
> the rest of the URL itself. If you have a URL library that is parsing
> +'s as spaces in the URL outside of a query string, that library is
> incorrect. Only %20 is valid as a space in that context.
>
> + signs are listed as a sub-delimiter (RFC 3986 Section 2.2) and part of
> the reserved character set, meaning they should be encoded if not doing
> so would create confusion in the URL schema. Encoding a + sign would be
> %2B. You're welcome to do that if you want to avoid confusion, but it
> really shouldn't be necessary.
The Go URL library encodes spaces in the query string as '+'. Is this
correct behavior?
More information about the Gemini
mailing list