diff options
author | VMiklos <vmiklos@frugalware.org> | 2007-10-06 17:35:55 +0200 |
---|---|---|
committer | VMiklos <vmiklos@frugalware.org> | 2007-10-06 17:35:55 +0200 |
commit | a75f2a7a6f57da846ab54d6fe5d52ec0c021a042 (patch) | |
tree | ef233fcb46c86fe5b038e88e52a69c24878fa422 | |
parent | 3922d44e2b9d4c970ed3697189fa63cdc9cbba6d (diff) |
display received messages in utf8, so that we can avoid most UnicodeEncodeErrors
-rw-r--r-- | skype/skyped.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/skype/skyped.py b/skype/skyped.py index 7e15b72f..22b0b322 100644 --- a/skype/skyped.py +++ b/skype/skyped.py @@ -102,13 +102,18 @@ class SkypeApi(): else: msg_text = [msg_text] for i in msg_text: - e = i.encode(locale.getdefaultlocale()[1]) + # use utf-8 here to solve the following problem: + # people use env vars like LC_ALL=en_US (latin1) then + # they complain about why can't they receive latin2 + # messages.. so here it is: always use utf-8 then + # everybody will be happy + e = i.encode('UTF-8') dprint('<< ' + e) if conn: try: conn.send(e + "\n") except IOError, s: - dprint("Warning, seding '%s' failed (%s)." % (e, s)) + dprint("Warning, sending '%s' failed (%s)." % (e, s)) def send(self, msg_text): if not len(msg_text): @@ -120,7 +125,7 @@ class SkypeApi(): except Skype4Py.ISkypeError: pass except Skype4Py.SkypeAPIError, s: - dprint("Warning, seding '%s' failed (%s)." % (e, s)) + dprint("Warning, sending '%s' failed (%s)." % (e, s)) class Options: def __init__(self): |