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 martin.panter
Recipients Emil Stenström, ezio.melotti, gvanrossum, martin.panter, vstinner
Date 2016-01-31.21:56:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1454277418.16.0.549884777131.issue26045@psf.upfronthosting.co.za>
In-reply-to
Content
Here is my cut down version of Guido’s patch. Now it only adds the message when someone passes a text string as the HTTPConnection.request(body=...) parameter:

>>> c.request("POST", "", body="Celebrate \U0001F389")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/proj/python/cpython/Lib/http/client.py", line 1098, in request
    self._send_request(method, url, body, headers)
  File "/home/proj/python/cpython/Lib/http/client.py", line 1142, in _send_request
    body = _encode(body, 'body')
  File "/home/proj/python/cpython/Lib/http/client.py", line 161, in _encode
    (name.title(), data[err.start:err.end], name)) from None
UnicodeEncodeError: 'latin-1' codec can't encode character '\U0001f389' in position 10: Body ('🎉') is not valid Latin-1. Use body.encode('utf-8') if you want to send it encoded in UTF-8.

What do people think?
History
Date User Action Args
2016-01-31 21:56:58martin.pantersetrecipients: + martin.panter, gvanrossum, vstinner, ezio.melotti, Emil Stenström
2016-01-31 21:56:58martin.pantersetmessageid: <1454277418.16.0.549884777131.issue26045@psf.upfronthosting.co.za>
2016-01-31 21:56:58martin.panterlinkissue26045 messages
2016-01-31 21:56:57martin.pantercreate