[issue14560] urllib2 cannot make POST with utf-8 content

2012-04-12 Thread Андрей Р

New submission from Андрей Р lans...@gmail.com:

Issue can be found only in 2.7, in 2.6.6 it works

System:
Linux strix 3.2.14-1-ARCH x86_64
Python information:
Python 2.7.2 (default, Jan 31 2012, 13:19:49) [GCC 4.6.2 20120120 
(prerelease)] on linux2

Snippet to reproduce error:

# -*- encoding: utf-8 -*-
import urllib2

request = urllib2.Request('http://google.com', u'Контент', {'Content-Type': 
'text/plain; charset=utf-8'})
urllib2.urlopen(request).read()

Stacktrace:

Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/lib/python2.7/urllib2.py, line 126, in urlopen
return _opener.open(url, data, timeout)
  File /usr/lib/python2.7/urllib2.py, line 394, in open
response = self._open(req, data)
  File /usr/lib/python2.7/urllib2.py, line 412, in _open
'_open', req)
  File /usr/lib/python2.7/urllib2.py, line 372, in _call_chain
result = func(*args)
  File /usr/lib/python2.7/urllib2.py, line 1199, in http_open
return self.do_open(httplib.HTTPConnection, req)
  File /usr/lib/python2.7/urllib2.py, line 1168, in do_open
h.request(req.get_method(), req.get_selector(), req.data, headers)
  File /usr/lib/python2.7/httplib.py, line 955, in request
self._send_request(method, url, body, headers)
  File /usr/lib/python2.7/httplib.py, line 989, in _send_request
self.endheaders(body)
  File /usr/lib/python2.7/httplib.py, line 951, in endheaders
self._send_output(message_body)
  File /usr/lib/python2.7/httplib.py, line 815, in _send_output
self.send(message_body)
  File /usr/lib/python2.7/httplib.py, line 787, in send
self.sock.sendall(data)
  File /usr/lib/python2.7/socket.py, line 224, in meth
return getattr(self._sock,name)(*args)

--
components: Unicode
messages: 158114
nosy: ezio.melotti, Андрей.Р
priority: normal
severity: normal
status: open
title: urllib2 cannot make POST with utf-8 content
versions: Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14560
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14560] urllib2 cannot make POST with utf-8 content

2012-04-12 Thread Андрей Р

Андрей Р lans...@gmail.com added the comment:

# -*- encoding: utf-8 -*-
import urllib2

request = urllib2.Request('http://google.com', u'Контент'.encode(utf-8), 
{'Content-Type': 'text/plain; charset=utf-8'})
urllib2.urlopen(request).read()

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14560
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14560] urllib2 cannot make POST with utf-8 content

2012-04-12 Thread Андрей Р

Changes by Андрей Р lans...@gmail.com:


--
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14560
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14560] urllib2 cannot make POST with utf-8 content

2012-04-12 Thread Андрей Р

Андрей Р lans...@gmail.com added the comment:

Sorry. My fault

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14560
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14560] urllib2 cannot make POST with utf-8 content

2012-04-12 Thread Senthil Kumaran

Changes by Senthil Kumaran sent...@uthcode.com:


--
nosy: +orsenthil

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14560
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com