Properly encode querystrings