开发者

Does URL querystring encoding preserve order for multi-valued keys?

开发者 https://www.devze.com 2023-04-11 03:33 出处:网络
http://www.example.com?a=1&a=2 has a valid form-urlencoded querystring and has two values (1 and 2) for the key a.

http://www.example.com?a=1&a=2 has a valid form-urlencoded querystring and has two values (1 and 2) for the key a.

  1. Is there any spec or standard for URL consumers guaranteeing ordering (开发者_JS百科or lack thereof) of parsed values?
  2. Do common implementations (Django's QueryDict, dojo's queryToObject, PHP, etc) preserve ordering?


OK, this question: Authoritative position of duplicate HTTP GET query keys, suggests there is no such standard and that order should not be considered reliable.

My experience has been that latest WebKit encodes identically named form fields in DOM order and that Django's QueryDict preserves that order. Shaky ground at best.

0

精彩评论

暂无评论...
验证码 换一张
取 消