Reputation: 9865
Using POST
is easy and automatic: just use application/x-www-form-urlencoded
or multipart/form-data
or whatever.
GET
request?The whole query string? Just the parameter values but not the names? And the fragment?
Maybe also the path? But I'm pretty sure that I shouldn't encode the host or the scheme (there are encoding and specs for international domains, like in Japanese etc.).
Hence the question is more about the URI 😉
I was surprised to not find a clear specific answer on SO, and on the internet too.
Upvotes: 5
Views: 4342
Reputation: 381
We have to encode the parts of the url (excluding the domain name) that may contain symbols and non ASCII characters excluding the slashes “/“ and the operands used by query strings (?, = and &).
Note: if you encode all the second part of the url together including the slashes and the operands used by the query strings, this part will be considered all as a single value and the url may not work properly.
Upvotes: 3