- Timestamp:
- 2007-08-20T18:56:46Z (17 years ago)
- Branches:
- master
- Children:
- 565982f
- Parents:
- 62bb4e4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
skype/skyped.py
r62bb4e4 rf932b65 15 15 CLIENT_NAME = 'SkypeApiPythonShell' 16 16 17 local_encoding = locale.getdefaultlocale()[1]18 need_conv = (local_encoding != 'utf-8')19 20 17 # well, this is a bit hackish. we store the socket of the last connected client 21 18 # here and notify it. maybe later notify all connected clients? 22 19 conn = None 23 24 def utf8_decode(utf8_str):25 if need_conv:26 return utf8_str.decode('utf-8').encode(local_encoding, 'replace')27 else:28 return utf8_str29 30 def utf8_encode(local_str):31 if need_conv:32 return local_str.decode(local_encoding).encode('utf-8')33 else:34 return local_str35 20 36 21 def sig_handler(signum, frame): … … 41 26 for i in input.split("\n"): 42 27 if i: 43 fd.send( skype.send(i.strip()) + "\n")28 fd.send((skype.send(i.strip()) + "\n").encode(locale.getdefaultlocale()[1])) 44 29 return True 45 30 … … 81 66 def Notify(self, msg_text): 82 67 global conn 83 text = utf8_decode(msg_text) 84 dprint('<< ' + text) 68 dprint('<< ' + msg_text) 85 69 if conn: 86 70 conn.send(msg_text + "\n") … … 92 76 dprint('>> ' + msg_text) 93 77 try: 94 reply = utf8_decode(self.skype_api.Invoke(utf8_encode(msg_text)))78 reply = self.skype_api.Invoke(msg_text) 95 79 except dbus.exceptions.DBusException, s: 96 80 reply = str(s)
Note: See TracChangeset
for help on using the changeset viewer.