Added url encoding of query string parameters

Added url encoding of query string parameters to ensure characters such
as the hash will not cause the generated url to be terminated
prematurely.