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 vajrasky
Recipients LDTech, Mi.Zou, christian.heimes, ezio.melotti, orsenthil, terry.reedy, vajrasky
Date 2013-07-19.04:45:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Lars, I see.

For the uninitiated, the issue is the original url (containing only ascii character) redirects to the url containing non-ascii characters which upsets urllib.

To handle that situation, you can do something like this:
import urllib.request
from urllib.parse import quote
url = ""
req = urllib.request.Request(url)
req.selector = urllib.parse.quote(req.selector)
response = urllib.request.urlopen(req, timeout=30)
the_page ='utf-8')

I admit it that this code is clunky and not pythonic.

I also believe in python standard library, we should have a module to access url containing non-ascii character in an easy manner.

At the very least, maybe we can give proper error message. Something like this would be nice:

"The url is not valid and contains non-ascii character:äfer/order/date_desc. This url is redirected from this url:"

Because users can be confused. They thought they already gave only-ascii-characters url ( to urllib, but why did they get encoding error?

What do you say, Christian?
Date User Action Args
2013-07-19 04:45:12vajraskysetrecipients: + vajrasky, terry.reedy, orsenthil, christian.heimes, ezio.melotti, Mi.Zou, LDTech
2013-07-19 04:45:12vajraskysetmessageid: <>
2013-07-19 04:45:12vajraskylinkissue17214 messages
2013-07-19 04:45:11vajraskycreate