monitor-ofono: Fix to print non-English characters
authorPhilippe Nunes <philippe.nunes@linux.intel.com>
Thu, 26 Jul 2012 15:57:53 +0000 (17:57 +0200)
committerDenis Kenzior <denkenz@gmail.com>
Fri, 27 Jul 2012 05:23:52 +0000 (00:23 -0500)
The default encoding for a Python bytestring is ASCII. But the
SMS/USSD text is encoded in UTF-8.
This is why trying to convert non-English characters (Unicode
characters beyond 128) produces the error
"UnicodeEncodeError: 'ascii' codec can't encode character".

test/monitor-ofono

index 8570c34..dcc5ff5 100755 (executable)
@@ -69,11 +69,11 @@ def event(member, path, interface):
 def message(msg, args, member, path, interface):
        iface = interface[interface.rfind(".") + 1:]
        print "{%s} [%s] %s %s (%s)" % (iface, path, member,
-                                       str(msg), pretty(args))
+                                       msg, pretty(args))
 
 def ussd(msg, member, path, interface):
        iface = interface[interface.rfind(".") + 1:]
-       print "{%s} [%s] %s %s" % (iface, path, member, str(msg))
+       print "{%s} [%s] %s %s" % (iface, path, member, msg)
 
 def value(value, member, path, interface):
        iface = interface[interface.rfind(".") + 1:]