summaryrefslogtreecommitdiff
path: root/omegle.py
diff options
context:
space:
mode:
Diffstat (limited to 'omegle.py')
-rw-r--r--omegle.py10
1 files changed, 8 insertions, 2 deletions
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")