示例#1
0
 def __set_text(self, text):
     try:
         sms_text = text.encode('sms-default')
         self.user_data_length = len(sms_text)
         self.user_data = pack_7bit_bytes(sms_text)
         self.encoding = DEFAULT_ALPHABET
     except UnicodeError, e:
         self.user_data = pack_ucs2_bytes(text)
         self.user_data_length = len(self.user_data) / 2
         self.encoding = UCS2
示例#2
0
 def __set_text(self, text):
     try:
         sms_text = text.encode('sms-default')
         self.user_data_length = len(sms_text)
         self.user_data = pack_7bit_bytes(sms_text)
         self.encoding = DEFAULT_ALPHABET
     except UnicodeError, e:
         self.user_data = pack_ucs2_bytes(text)
         self.user_data_length = len(self.user_data) / 2
         self.encoding = UCS2
 def test_pack_7bit_bytes(self):
     # 07911356131313F311000A9260214365870000AA04E8373B0C
     self.assertEqual(pack_7bit_bytes('hola'), 'E8373B0C')