This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Dubslow
Recipients Dubslow, ezio.melotti, vstinner
Date 2014-02-08.05:11:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1391836316.13.0.734249225356.issue20559@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2014-02-08 05:11:56Dubslowsetrecipients: + Dubslow, vstinner, ezio.melotti
2014-02-08 05:11:56Dubslowsetmessageid: <1391836316.13.0.734249225356.issue20559@psf.upfronthosting.co.za>
2014-02-08 05:11:56Dubslowlinkissue20559 messages
2014-02-08 05:11:55Dubslowcreate