I know I need to encode the arguments of parameters in a query string of a URI, but what about the parameter names, do they need to be encoded too?
Asked
Active
Viewed 1,034 times
2
-
I can't think of a reason why parameter name would need to be encoded. I am struggling with the same question, and so far nothing came up in my searches. – manish Jul 25 '18 at 16:25
1 Answers
1
Yes. Special characters in query strings have their special meaning anywhere in the query string.
If the parameter name is foo=bar then ?foo=bar=something won't be parsed as foo=bar equals something.
Quentin
- 857,932
- 118
- 1,152
- 1,264
-
*"won't be parsed"* - it depends on the parsing implementation, isn't it (hypothetically, a parsing implementation may decide that for each query string parameter all `=` except the last one are ignored)? after all, `=` is [allowed unencoded in a query string](https://stackoverflow.com/a/31300627/3002584). – OfirD Mar 04 '21 at 21:37