From 8f3af268d4091fd6488a23480cbfdd9351046f42 Mon Sep 17 00:00:00 2001 From: yvesf Date: Wed, 10 Jun 2009 21:15:33 +0000 Subject: iblah git-svn-id: http://xapek.org/svn/common/omegle@1107 d0e8fea9-7529-0410-93fb-d39fd5b9c1dd --- omegle.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'omegle.py') diff --git a/omegle.py b/omegle.py index 2713636..8aac69e 100644 --- a/omegle.py +++ b/omegle.py @@ -125,9 +125,15 @@ class OmegleChat(RESTClient): """ #if a raw string given, assume its utf8 if msg.__class__ == str: - msg = msg.decode("utf8") + try: + msg = msg.decode("utf8") + except UnicodeDecodeError: + pass #convert utf8 to RAW-utf8 - msg = msg.encode("utf8") + try: + msg = msg.encode("utf8") + except UnicodeEncodeError,e: + self.logger.critical(e) if not self.is_confirmed: self.logger.error("Cant send message if not is_confirmed") -- cgit v1.2.1