aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@calcurse.org>2016-06-17 09:19:25 +0200
committerLukas Fleischer <lfleischer@calcurse.org>2016-06-18 10:30:30 +0200
commitb6f95b380f9662f9294b291c9a061750125bb7eb (patch)
tree1260839d38b9d48cda5ba790f95b02035bbe3589
parent5d793f6b35eb9aac6113545d3d2cb90874b4bc01 (diff)
downloadcalcurse-b6f95b380f9662f9294b291c9a061750125bb7eb.tar.gz
calcurse-b6f95b380f9662f9294b291c9a061750125bb7eb.zip
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>
-rwxr-xr-xcontrib/caldav/calcurse-caldav.py3
1 files changed, 3 insertions, 0 deletions
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()