Ensure query strings are escaped properly; fixes #324
Merge pull request #325 from jamiehannaford/query-encoding-fix

Escape query strings