Properly encoding URI query strings