Skip to content

Commit

Permalink
SMS in UTF-8 were being dropped by RAPI
Browse files Browse the repository at this point in the history
  • Loading branch information
Keith committed Apr 27, 2016
1 parent b0e5989 commit 0ef3925
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion rccn/modules/sms.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,11 @@ def receive(self, source, destination, text, charset, coding):
raise SMSException('Receive SMS Error: %s' % e)

def send(self, source, destination, text, server=config['local_ip']):
enc_text = urllib.urlencode({'text': text })
try:
text=unicode(text).encode('utf-8')
enc_text = urllib.urlencode({'text': text })
except UnicodeEncodeError:
raise SMSException('Can\'t handle the Character Set')
if server == config['local_ip']:
try:
sms_log.info('Send SMS: %s %s' % (source, destination))
Expand Down

0 comments on commit 0ef3925

Please sign in to comment.