2

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?

unor
  • 92,415
  • 26
  • 211
  • 360
Trident D'Gao
  • 18,973
  • 19
  • 95
  • 159
  • 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 Answers1

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
  • 914,110
  • 126
  • 1,211
  • 1,335
  • *"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