Commits

Matthew Schinckel  committed 35de172

Ensure message is unicode before converting it to ascii.

  • Participants
  • Parent commits d05efa5

Comments (0)

Files changed (1)

File sms/models/gateway.py

         #     raw_data[self.content_keyword] = "".join(["%04x" % ord(x) for x in message.content])
         #     raw_data["unicode"] = 1
         # else:
-        raw_data[self.content_keyword] = unicodedata.normalize('NFKD', message.content).encode('ascii', 'ignore')
+        raw_data[self.content_keyword] = unicodedata.normalize('NFKD', unicode(message.content)).encode('ascii', 'ignore')
         if self.uuid_keyword:
             assert message.uuid, "Message must have a valid UUID. Has it been saved?"
             raw_data[self.uuid_keyword] = message.uuid
         
         message.save()
         
-        return message
+        return message