def urlencode_utf8(params):

    if hasattr(params, 'items'):
        params = params.items()

    params = (
        '='.join((
            urllib.quote_plus(k.encode('utf8'), safe='/'),
            urllib.quote_plus(v.encode('utf8'), safe='/')
        )) for k, v in params
    )

    return '&'.join(params)
UTF-8 safe variant of urllib.urlencode.
dataset/ETHPy150Open Nordeus/pushkin/pushkin/sender/nordifier/gcm.py/urlencode_utf8