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 LDTech
Recipients LDTech, Mi.Zou, ezio.melotti, orsenthil, terry.reedy
Date 2013-07-16.16:43:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1373993010.77.0.411579321359.issue17214@psf.upfronthosting.co.za>
In-reply-to
Content
This problem still exist in Python 3.3.2. The following code gives you an example:

import urllib.request
url = "http://www.libon.it/libon/search/isbn/3499155443"
req = urllib.request.Request(url)
response = urllib.request.urlopen(req, timeout=30)
the_page = response.read().decode('utf-8')
print(the_page)


Traceback (most recent call last):
  File "C:\X\webpy.py", line 4, in <module>
    response = urllib.request.urlopen(req, timeout=30)
  File "C:\Python33\lib\urllib\request.py", line 156, in urlopen
    return opener.open(url, data, timeout)
  File "C:\Python33\lib\urllib\request.py", line 475, in open
    response = meth(req, response)
  File "C:\Python33\lib\urllib\request.py", line 587, in http_response
    'http', request, response, code, msg, hdrs)
  File "C:\Python33\lib\urllib\request.py", line 507, in error
    result = self._call_chain(*args)
  File "C:\Python33\lib\urllib\request.py", line 447, in _call_chain
    result = func(*args)
  File "C:\Python33\lib\urllib\request.py", line 692, in http_error_302
    return self.parent.open(new, timeout=req.timeout)
  File "C:\Python33\lib\urllib\request.py", line 469, in open
    response = self._open(req, data)
  File "C:\Python33\lib\urllib\request.py", line 487, in _open
    '_open', req)
  File "C:\Python33\lib\urllib\request.py", line 447, in _call_chain
    result = func(*args)
  File "C:\Python33\lib\urllib\request.py", line 1268, in http_open
    return self.do_open(http.client.HTTPConnection, req)
  File "C:\Python33\lib\urllib\request.py", line 1248, in do_open
    h.request(req.get_method(), req.selector, req.data, headers)
  File "C:\Python33\lib\http\client.py", line 1061, in request
    self._send_request(method, url, body, headers)
  File "C:\Python33\lib\http\client.py", line 1089, in _send_request
    self.putrequest(method, url, **skips)
  File "C:\Python33\lib\http\client.py", line 953, in putrequest
    self._output(request.encode('ascii'))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 78-79: ordinal not in range(128)
History
Date User Action Args
2013-07-16 16:43:30LDTechsetrecipients: + LDTech, terry.reedy, orsenthil, ezio.melotti, Mi.Zou
2013-07-16 16:43:30LDTechsetmessageid: <1373993010.77.0.411579321359.issue17214@psf.upfronthosting.co.za>
2013-07-16 16:43:30LDTechlinkissue17214 messages
2013-07-16 16:43:30LDTechcreate