Message259301
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? |
|
Date |
User |
Action |
Args |
2016-01-31 21:56:58 | martin.panter | set | recipients:
+ martin.panter, gvanrossum, vstinner, ezio.melotti, Emil Stenström |
2016-01-31 21:56:58 | martin.panter | set | messageid: <1454277418.16.0.549884777131.issue26045@psf.upfronthosting.co.za> |
2016-01-31 21:56:58 | martin.panter | link | issue26045 messages |
2016-01-31 21:56:57 | martin.panter | create | |
|