Message210590
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. |
|
Date |
User |
Action |
Args |
2014-02-08 05:11:56 | Dubslow | set | recipients:
+ Dubslow, vstinner, ezio.melotti |
2014-02-08 05:11:56 | Dubslow | set | messageid: <1391836316.13.0.734249225356.issue20559@psf.upfronthosting.co.za> |
2014-02-08 05:11:56 | Dubslow | link | issue20559 messages |
2014-02-08 05:11:55 | Dubslow | create | |
|