Open Source Telephony
 help / color / mirror / Atom feed
From: Philippe Nunes <philippe.nunes@linux.intel.com>
To: ofono@ofono.org
Subject: [PATCH] monitor-ofono: Fix to print non-English characters
Date: Thu, 26 Jul 2012 17:57:53 +0200	[thread overview]
Message-ID: <1343318274-19845-1-git-send-email-philippe.nunes@linux.intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1085 bytes --]

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 |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/monitor-ofono b/test/monitor-ofono
index 8570c34..dcc5ff5 100755
--- a/test/monitor-ofono
+++ b/test/monitor-ofono
@@ -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:]
-- 
1.7.9.5


             reply	other threads:[~2012-07-26 15:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-26 15:57 Philippe Nunes [this message]
2012-07-26 15:57 ` [PATCH v2] test-ussd becomes send-ussd This script can be used to handle network initiated USSDs Philippe Nunes
2012-07-27  5:36   ` Denis Kenzior
2012-07-27  5:34 ` [PATCH] monitor-ofono: Fix to print non-English characters Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1343318274-19845-1-git-send-email-philippe.nunes@linux.intel.com \
    --to=philippe.nunes@linux.intel.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox