From b6f95b380f9662f9294b291c9a061750125bb7eb Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Fri, 17 Jun 2016 09:19:25 +0200 Subject: 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 --- contrib/caldav/calcurse-caldav.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/contrib/caldav/calcurse-caldav.py b/contrib/caldav/calcurse-caldav.py index 1751897..2ea0152 100755 --- a/contrib/caldav/calcurse-caldav.py +++ b/contrib/caldav/calcurse-caldav.py @@ -108,6 +108,9 @@ def remote_query(conn, cmd, path, additional_headers, body): print("> " + line) print() + if isinstance(body, str): + body = body.encode('utf-8') + conn.request(cmd, path, headers=headers, body=body) resp = conn.getresponse() -- cgit v1.2.3