From 19519b2132004fc875aedcd1033b16c15732cbc3 Mon Sep 17 00:00:00 2001 From: Neil Jerram Date: Fri, 21 Nov 2014 01:48:26 +0000 Subject: [PATCH] test: Support receiving SMS with non-ASCII chars Without this I get the following Python traceback, for an SMS that contains the UK pound sign. ERROR:dbus.connection:Exception in handler for D-Bus signal: Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 230, in maybe_handle_message self._handler(*args, **kwargs) File "./receive-sms", line 9, in incoming_message print("%s" % (message)) UnicodeEncodeError: 'ascii' codec can't encode character u'\xa3' in position 51: ordinal not in range(128) --- test/receive-sms | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/receive-sms b/test/receive-sms index a0c69150..f5e247e7 100755 --- a/test/receive-sms +++ b/test/receive-sms @@ -6,7 +6,7 @@ import dbus import dbus.mainloop.glib def incoming_message(message, details, path, interface): - print("%s" % (message)) + print("%s" % (message.encode('utf-8'))) for key in details: val = details[key]