calcurse-caldav: Encode the request body in UTF-8

When a string is passed to HTTPConnection.request(), it is automatically
ISO 8859-1 encoded. Therefore, since we already specify UTF-8 as
character set in the headers, we need to UTF-8 encode the request body
manually.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
Lukas Fleischer 2016-06-17 09:19:25 +02:00
parent 5d793f6b35
commit b6f95b380f

View File

@ -108,6 +108,9 @@ def remote_query(conn, cmd, path, additional_headers, body):
print("> " + line) print("> " + line)
print() print()
if isinstance(body, str):
body = body.encode('utf-8')
conn.request(cmd, path, headers=headers, body=body) conn.request(cmd, path, headers=headers, body=body)
resp = conn.getresponse() resp = conn.getresponse()