From 6bf2732d7f96b5ac30356d4e53627e8a55e44e68 Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Sat, 11 Jul 2015 08:09:53 -0500 Subject: [PATCH] dispatch: handle writing unicode to file properly --- dr_botzo/dispatch/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dr_botzo/dispatch/views.py b/dr_botzo/dispatch/views.py index 77b90ab..70bd572 100644 --- a/dr_botzo/dispatch/views.py +++ b/dr_botzo/dispatch/views.py @@ -93,7 +93,7 @@ class DispatchMessage(generics.GenericAPIView): filename = os.path.abspath(action.destination) log.debug("sending '%s' to file %s", text, filename) with open(filename, 'w') as f: - f.write(text) + f.write(text.encode('utf8')) f.write(b'\n') new_data = copy.deepcopy(message.data)