programatically edit numbers from messages Here is the issue 

i changed phones.. 

i before hand backed up calls and messages using sms backup and restore. everything went fine. I have the xml files i can see the messages and the numbers correctly in the xml. 

the restore in the new  phone for some reason decided to add the sim country code to every number that did not have a country code which made the numbers completely unusable 
I do not understand from where come the country code I do not see anywhere the settings in the aosp messaging app to remove the country code. 

is there a way to edit the numbers on the messages or to make sms backup and restore app not to add the country code of the sim card.. I think it detects the country of the sim or the country of the phone based on imei? and then if a phone does not start by +xxx it add it..

I find totally unacceptable that the restore got somehow altered. and I cannot find the root cause.. 

questions is can i use adb or some api in python or whatever to fix the mistakes.. I still have the original xml files from sms backup and restore with the numbers untouched. 

thank you
You can edit the XML files and add the right country codes before import. If you want to fix it programatically directly on phone you need root access.