homepage

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月18日.15:10:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1374160243.29.0.560739136632.issue17214@psf.upfronthosting.co.za>
In-reply-to
Content
I have no problem if this ticket is classified as "won't fix".
I am writing this for the confused souls who want to use urllib to access url containing non-ascii characters:
import urllib.request
from urllib.parse import quote
url = "http://www.libon.it/ricerca/7817940/3499155443/dettaglio/3102314/Onkel-Oswald-und-der-Sudan-Käfer/order/date_desc"
req = urllib.request.Request(url)
try:
 req.selector.encode('ascii')
except UnicodeEncodeError:
 req.selector = quote(req.selector)
response = urllib.request.urlopen(req, timeout=30)
the_page = response.read().decode('utf-8')
print(the_page)
History
Date User Action Args
2013年07月18日 15:10:43vajraskysetrecipients: + vajrasky, terry.reedy, orsenthil, christian.heimes, ezio.melotti, Mi.Zou, LDTech
2013年07月18日 15:10:43vajraskysetmessageid: <1374160243.29.0.560739136632.issue17214@psf.upfronthosting.co.za>
2013年07月18日 15:10:43vajraskylinkissue17214 messages
2013年07月18日 15:10:43vajraskycreate

AltStyle によって変換されたページ (->オリジナル) /