There shouldn't be a case where it's not encoded.

I'm using urlencode because that looks like the suggested way of flattening a dict back into a query string.