use django urlencode and let it handle the compatibility problems