Bill Winslow added the comment:
Follow up -- I need to use urllib.parse.quote to safely encode a url -- though
if I may be so bold, I submit that since much of the goal of Python 3 was to
make unicode "just work", I the (stupid) user shouldn't have to remember to
safely encode unicode urls...
A reasonable way to do it would be to insert the following in place of
urllib/request.py line 469 (which is OpenerDirector.open()):
response = self._open(req, data)
would become
try:
response = self._open(req, data)
except UnicodeDecodeError as e:
req.full_url = quote(req.full_url, safe='/%')
response = self._open(req, data)
That's untested of course, but hopefully it'll encourage discussion.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue20559>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com