Use quote_plus and unquote_plus for query string, and avoid implicit unicode encode/decode.