modified the Py3 url encoding code