Re: Internationalized domain names not working with URLopen

2012-06-13 Thread John Nagle
On 6/12/2012 11:42 PM, Andrew Berg wrote: On 6/13/2012 1:17 AM, John Nagle wrote: What does "urllib2" want? Percent escapes? Punycode? Looks like Punycode is the correct answer: https://en.wikipedia.org/wiki/Internationalized_domain_name#ToASCII_and_ToUnicode I haven't tried it, though.

Re: Internationalized domain names not working with URLopen

2012-06-13 Thread Hemanth H.M
My bad, it worked; need to avoid http:// along with snowman, before encode. On Wed, Jun 13, 2012 at 9:02 PM, Hemanth H.M wrote: > Well not really! does not work with '☃.net' > > Traceback (most recent call last): > File "", line 1, in > File "/usr/lib/python2.6/urllib2.py", line 126, in url

Re: Internationalized domain names not working with URLopen

2012-06-13 Thread Hemanth H.M
Well not really! does not work with '☃.net' Traceback (most recent call last): File "", line 1, in File "/usr/lib/python2.6/urllib2.py", line 126, in urlopen return _opener.open(url, data, timeout) File "/usr/lib/python2.6/urllib2.py", line 391, in open response = self._open(req, da

Re: Internationalized domain names not working with URLopen

2012-06-12 Thread Виталий Волков
Answer in this topic should help you to solve issue. http://stackoverflow.com/questions/8152161/open-persian-url-domains-with-urllib2?answertab=active#tab-top Regards. 2012/6/13 John Nagle > I'm trying to open > > http://пример.испытание > > with > > url

Re: Internationalized domain names not working with URLopen

2012-06-12 Thread Andrew Berg
On 6/13/2012 1:17 AM, John Nagle wrote: > What does "urllib2" want? Percent escapes? Punycode? Looks like Punycode is the correct answer: https://en.wikipedia.org/wiki/Internationalized_domain_name#ToASCII_and_ToUnicode I haven't tried it, though. -- CPython 3.3.0a3 | Windows NT 6.1.7601.17790

Internationalized domain names not working with URLopen

2012-06-12 Thread John Nagle
I'm trying to open http://пример.испытание with urllib2.urlopen(s1) in Python 2.7 on Windows 7. This produces a Unicode exception: >>> s1 u'http://\u043f\u0440\u0438\u043c\u0435\u0440.\u0438\u0441\u043f\u044b\u0442\u0430\u043d\u0438\u0435' >>> fd = urllib2.urlopen(s1) Traceback (most recent c