As promised here’s a copy of my iPhone to Android script. Just a quick and dirty python script that reads in a backup from itunes and converts it to a bit of XML able to be read in by SMS Backup and Restore on the android platform
from sqlite3 import * from sqlite3 import * from xml.sax.saxutils import escape import codecs import re f = codecs.open('sms.xml','w','utf-8') f.write (''' ''') # This is 31bb7ba8914766d4ba40d6dfb6113c8b614be442.mddata or 31bb7ba8914766d4ba40d6dfb6113c8b614be442.mdbackup usally c = connect('sms.db') curs = c.cursor() curs.execute('''SELECT address,date,text,flags FROM message WHERE flags <5 ORDER BY date asc''') for row in curs: a= escape(unicode(row[0])) d = escape(unicode(row[1])) t = row[3]-1 t = str(t) b = re.sub('"',"'",escape(unicode(row[2]))) f.write( ''+"n") f.write( '''''' )
One reply on “iPhone to Android SMS Converstion Script”
hello,
I have an iPhone and I wanted to convert every single SMS in an eml file (then i import this eml into Gmail via IMAP, so I have all text messages on gmail). Could you help me create a script to do this?
thanks and congratulations for the blog!