Nokia NFB files
Status: I can get the address book from NFBs from 6310i. However, I have not yet succeeded with the 7610, with which I’m currently doing battle. Post a comment if you’ve got any special requests.
The whole reason for this site coming about was the fact I got a camera phone. However, what you don’t know is why…
My lovely reliable 6310i broke. That is to say, it began running fast. Everything it did was happening about 8 times faster. The menu animations, tones, charging animation, and timing out on the network. This was bad, as it rendered it unusable. I couldn’t even synch it with the PC to ensure I had an up-to-date backup, as it would timeout.
So, I was left with an NFB file that was a few weeks old. Not too bad you might think. And I did. Until, that is, I tried to restore the backup to my new Nokia phone. However, it’s not possible to restore to a different model of phone. So, I need to convert my NFB file to a nice plain text file that I can get onto my new phone.
Update: I have made this converter available online here.
Here’s how:
1) Download nfbfile.py
2) Run the following command:
./nfbfile.py -v -v -x mybackup.nfb /MPAPI/PHONEBOOK >phonebook.pb
3) You can now cat that file, but it isn’t plain text. So, it calls for a bit of PHP (trimextras.php)
< ?php
$filename=$_SERVER['argv'][1];
$handle = fopen($filename, "r");
$contents = fread($handle, filesize($filename));
fclose($handle);
echo str_replace(array(chr(255),chr(254),chr(0)),"",$contents);
?>
4) Run this as follows:
php trimextras.php phonebook.pb >phonebook.txt
5) Now, each row looks something like:
200 PIT_CONTACT 202 My Name 210 Mobile 205 email@email.com 219 Office 211 Fax 226 Notes 206 Address
So it’s necessary (somehow) to parse it into a nice CSV file and then (hopefully) I’ll be able to import that onto my new phone.
If you have an NFB file you’d like recovering, then post a comment and I’ll see what I can do. If lots of people want it, I’ll try to do a web interface.
Right. Then the following processed it all into CSV. Webpage shortly
< ?php
// Get the file:
$filename=$_SERVER['argv'][1];
$handle = fopen($filename, \"r\");
$contents = fread($handle, filesize($filename));
fclose($handle);
// Output file:
$filename=\"op.csv\";
$fp = fopen($filename,\"w\");
// Break it up a bit:
$columns=array();
$entries = explode(\"\n\",trim($contents));
foreach ($entries as $entry) {
if (substr($entry,0,3)==\"200\") {
$elements = explode(\"\t\",substr($entry,strlen(\"200\tPIT_CONTACT\t\")));
if (count($elements)%2==1) {
echo \"Expected an even number of elements\n\";
print_r($elements);
} else {
$data=\"\";
$k++;
for ($i = 0; $i199))) {
echo “Did not understand “.$elements[$i].”\n”;
} else {
$data[$elements[$i]]=$elements[$i+1];
if (!in_array($elements[$i],$columns)) $columns[]=$elements[$i];
}
}
$alldata[]=$data;
}
} else {
echo “Did not understand “.$entry.”\n”;
}
}
asort($columns);
foreach ($alldata as $data) {
foreach ($columns as $column) {
fwrite($fp,”\"”.$data[$column].”\",”);
}
fwrite($fp,”\"”\n”);
}
echo “Found $k people\n”;
fclose($fp);
echo “Done\n”;
?>