Improve query string handling. 

* Add objectToQuery and queryToObject.
* Start replacing fragile URL query string manipulation with those functions.
* Fix specs that incorrectly depended on exact URL string equality, and other spec cleanup.

Fixes #2165
I updated the examples.  It's a bit of an edge case that I only added because the Dojo equivalents support it.  Occasionally it's useful, e.g. Rails uses multiple duplicate parameter names to send arrays to controller methods.