Is there a python library for encoding ascii data to 7-bit GSM character set (for sending SMS)?
I could not find any library. But I think this should not need a library. Its somewhat easy to do.
Here is Jon Skeet himself on the same topic.
Example:
s = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
def ascii_to_gsm(ch):
return bin(65 + s.index(ch))
print ascii_to_gsm('A')
print '--'
binary_stream = ''.join([str(ascii_to_gsm(ch))[2:] for ch in s])
print binary_stream
You can also use dict
to store mapping between ASCII and GSM 7-bit character set.