Meaning that parsing the query string into a dictionary makes an unjustified assumption on the form of the query (which by the way can take other forms, wikipedia mentions the semicolon as a valid separator for parameters as well as the ampersand).
The correct fix would consist in storing the original query string, also parse it into a dictionary if needed/required, and when returning a string representation of the URI, use the original query string.
Interestingly, I couldn't find in the RFC any details on the expected syntax of the query part of a URI (http:// tools.ietf. org/html/ rfc3986# section- 3.4), and wikipedia seems to confirm that "the query string syntax is not generically defined" (http:// en.wikipedia. org/wiki/ URI_scheme# Generic_ syntax).
Meaning that parsing the query string into a dictionary makes an unjustified assumption on the form of the query (which by the way can take other forms, wikipedia mentions the semicolon as a valid separator for parameters as well as the ampersand).
The correct fix would consist in storing the original query string, also parse it into a dictionary if needed/required, and when returning a string representation of the URI, use the original query string.