Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Migrate phone numbers from Nokia 6303c to Nokia 216 then to CAT B30, or the quest for a sane phone

by ambrus (Abbot)
on Nov 06, 2018 at 22:23 UTC ( #1225327=CUFP: print w/replies, xml ) Need Help??

For a very long time, I've been using a Nokia 6303 classic phone. I was very satisfied with that phone. the built-in camera made good photos, I could use the music player to listen to music through headphones, and the user interface was usable.

You may recall that back in 2016, I even wrote a perl script to decode the contact lists after that phone backs it up into a zip file (with .NBF extension) containing indivdual files for each contact. That script exports phonebook entries into a semicolon-separated file with lines like this:

BME központi;+3614631111

That's a simple entry. Some lines list additional data, such as multiple phone numbers and possibly text notes in the same entry separated by a semicolon. I never figured out how to make a backup file that the phone could import though. In fact I once had to restore all the backups by hand.

In 2017-11, I bought a Nokia 216 as a spare phone, because I figured that if I lose my phone or it becomes non-functional, I'd like to have a spare phone at hand immediately. That one only has a much worse camera, but that didn't matter anymore, because I had a pretty good compact camera now. I charged the phone and verified that it worked, then put it in a drawer.

In 2018-08, I lost the Nokia 6303. I cleaned it with too much water, which in itself wouldn't have been a problem, but I then put the battery back in the phone before it dried properly. The phone turned on, but went off after a few seconds, and I couldn't revive it after drying. I'd like to add that this was the second time the phone got wet, it has survived falling into the toilet once before.

So I mourned for the old phone, but was happy that I had the foresight to have bought a replacement earlier. For a few days.

I actually also had the foresight to have most of the important phone numbers copied to the SIM card, so I could transfer those phone numbers to the new phone by copying from that, and entered a few more important ones from the dump of the backup, so I had like fifty important phone numbers in the phone. You may ask why I don't just transfer all phone numbers through SIM cards then, since SIM cards are pretty cheap, and I have several old spare ones in my drawer. The problem is that the contact list stored on SIM cards has some big limitations: names can't be longer than about 15 bytes (some characters take more than one byte, I don't know the exact rule), the card can only store 250 contacts (I already had more than that back then), and the card can't store additional information such as notes.

Anyway, I at least got a phone that I could use for a temporary basis, and transfering the whole contact list was something that could wait a few days. But since I actually tried to use the phone for other tasks, and it turned out to be a disaster.

It only took a few days to find out how terrible the user interface of the Nokia 216 was. How I raged!

The way button presses are assigned are bad everywhere, but especially for the main screen and locked state are terrible. Not only do I have to press much more buttons to do the same thing than on the 6303, but it's also close to impossible to use the phone without looking at it all the time. I specifically chose a phone with a keypad that isn't completely flat, so that I can type messages blindly. Finding that I have to constantly look at the display for much more operations than in the 6303 was bad.

The phone doesn't know how to assign separate ringtones for different people. It insists that I can only use one ringtone for everyone. On the 6303, I used four different ringtones, with different family members assigned to three different ones, and everyone else on a fourth ringtone by default.

The messages menu is terrible. You can accidentally get messages you are writing into a state where they're still in the phone, but all you can do with it is retry sending to an invalid phone number or delete, you can't view or edit the message, you have to retype it.

The music player is practically unusuable, because it can't play an album with the tracks in order, even in albums that I have encoded myself where all the music files have proper meta-information like album name and track number in it, and the filenames are consistent and differ only in a track number that I even zero-padded to two digits. Apparently the phone doesn't even make an effort to sort the tracks, it just plays them in the order they appear in the directory entry or something.

The volume control of the 6303 was bad if you tried to use it through headphones, in that you could listen to music through the headphones loud or very loud, but quietly, but the volume control of the 216 is even worse. It doesn't matter much for music, which I can't listen to anyway, but this also makes sure that I can't listen to radio and can't even conveniently make a phone call through the headphones in quiet environment without having to listen to a too loud voice.

The calendar is limited to 25 entries, and each entry can only have 39 characters of text to it. How am I supposed to write the location of a meeting in 39 characters? Use the notes list then, which in the 6303 I used to store shopping lists and other notes like that? You can, for the location and directions of the next meeting, but not for a shopping list, because each note can only be 100 character long. By the way, the contact list also doesn't take notes, you can only enter a name and one phone number to each entry. The name can be 30 character long in theory, but in practice you can use much less than that, because you can only see one line of the name when browsing the phonebook, and you can't scroll the names without trying to edit them. It's like they don't know how to use dynamic allocation for the flash memory, only they certainly do, because the phone still has a camera and can store photos of various sizes.

The phone also doesn't say "Nokia 216" anywhere, not in the sticker under the battery, nor in the interface. I think the phone manufacturers are so ashamed of this phone line that they tried to make sure people don't write bad reviews by releasing a whole line of phones that look confusingly similar to each other, and not writing the type on any of them.

There are only three good things I can say about the Nokia 216: it generally reacts quickly enough to keypresses, it accepts two SIM cards, and it's possible to import a contact list prepared on a computer.

Here's how I imported the contact list. After finding out the limitations of the phone, First, I edited the semicolon-separated backup file to shorten the names and otherwise clean up the list. While I was there, I fixed all the names to have the correct letters, because some of the entries actually had names inherited from one of the two even older phones, which didn't have a full character set, so they had characters like "ŕ" instead of "á" and "ö" instead of "ő" I never bothered to fix that on the 6303, even though that one already supported all letters of Hungarian, and I entered all the new names with the correct characters. Then I used a messy perl script to verify that the list of contacts looks fine, and convert them to the format that the 216 accepts, which I could reverse engineer from an exported contact list in a few tries. Here's the code, with a few details omitted.

#!perl use strict; use warnings; use re "/u"; open my$I, "<:encoding(utf-8)", $ARGV[0] or die qq(error open: $!); open my$O, ">", $ARGV[1] or die qq(open out: $!); binmode STDERR, ":encoding(cp852)" or die; my$counter = 0; while(my$l = <$I>) { chomp $l; $l =~ tr/[\x00-\x1f\x7f-\x90]// and die qq(error: control characte +rs); my($n, @r) = split /;/, $l; 4 <= length $n || "\xc9n" eq $n || "P\x{f3}t" eq $n or die qq(erro +r: name too short: $n); $n =~ /\A[-+.,0-9 A-Za-z\x{c1}\x{c9}\x{cd}\x{d3}\x{d6}\x{0150}\x{d +a}\x{dc}\x{0170}\x{e1}\x{e9}\x{ed}\x{f3}\x{f6}\x{151}\x{fa}\x{fc}\x{1 +71}]{2,}\z/ or die qq(error: strange characters $n); $n =~ /\A\p{Lu}|\A\+\p{Ll}/ or die qq(error: name doesn't start wi +th letter: $n); $n =~ /(?:\pL){4}|(?:\pL){3}.*(?:\pL){3}z/ or die qq(error: name n +ot enough letters: $n); # the actual code has more branches here to w +hitelist some short names in my phonebook $n =~ / \z/ and die qq(trailing space: $n); $n =~ /[0-9\pL]\z/ or die qq(trailing punct: $n); $n =~ y/[0-9]// <= 4 or die qq(error: name has too many digits: $n +); my@t; F: for my$r (@r) { $r =~ /\A(X-NOKIA-PND-GROUP|NOTE)=/ and next; $r =~ /=/ and die qq(strange field: $r); $r =~ /\A[+p0-9*#]+\z/ or die qq(not phone number: $r); if ($r =~ /\A\+36/) { $r =~ /\A\+36(?:1[0-9]{7}|[237][0-9]+|([2-9][1-9]|[8]0)[0- +9]{6})(p[0-9*#]+)?\z/ or warn qq(wrong length or landline hu: $r); # +this one is actually incorrect since there are now new 7-digit mobile + phone numbers starting with +3631 and +3650, but I didn't have any i +n my phonebook yet } elsif ($r =~ /\A\+[1-9][0-9]{8,}+\z/) { 0 and warn qq(abroad: $r $n); # I had these and the follow +ing warnings disabled after I verified that the few numbers they matc +hed were valid } elsif ($r =~ /\A1[0-9]{3,4}\z/) { 0 and warn qq(shortcut number: $r $n); } elsif ($r =~ /\Ap.*\z/) { 0 and warn qq(comment: $r $n); } elsif ($r =~ /\A[*#][0-9*#]{3,12}\z/ && $n =~ /\A\+/) { 0 and warn qq(code: $r $n) } else { die qq(invalid number: $r $n); } push @t, $r; } @t or die qq(no number in line: $l); @t<=2 or die qq(more than two numbers in line: $l); for my$ii (keys @t) { my$t = $r[$ii]; my$nn = $n . "'" x $ii; length($nn) < 30 or die qq(name too long); print $O qq(BEGIN:VCARD\nVERSION:2.1\nN;ENCODING=QUOTED-PRINTA +BLE;CHARSET=UTF-8:;=\n) or die; my$no = Encode::encode_utf8($nn); $no =~ s{([^a-zA-Z0-9])}{sprintf "=%02X", ord$1}ge; print $O qq($no;;;\nTEL;VOICE;CELL:$t\nEND:VCARD\n\n) or die; } } eof($I) or die qq(error read); close $O or die qq(error read); warn qq(tovcard all ok;\n); __END__

This emits a single contacts file in vcard format with entries like this.


Two phone numbers in the same entry are handled by writing it as two entries, but extra notes are discarded.

You must copy that file to the SD card (either with an SD card reader or through a USB cable) as "/Backup/backup.dat", then restore the backup in the settings. Note that this will erase the existing contacts in the memory of the phone (but not the SIM card).

Note also that if you accidentally disconnect the USB cable before pressing the button on the phone to stop acting as a remote drive, then the phone freezes and you must reboot it; and that if you remove the battery of the phone to access the SD card to write it directly instead, then the phone forgets the date and time (on the 6303 you can remove or reinsert the SD card without removing the battery).

Anyway, I eventually set off to try to buy a better phone. That's not easy. It's hard to find reviews of cheap feature phones, or find copies that I can try without having to buy them.

I quickly bought a Nokia 150, which is a later phone in the same line, because the reasoning that I want to have a spare phone at hand just in case anyone happens to my phone still stood, but it turned out to be even worse than the 216, so I never used it as more than a spare. (Incidentally, the same contact list as for the 216 works for the Nokia 150, but there you have to use put the file as "/backup.dat" in the root directory of the SD card instead.)

Eventually in 2018-11, I bought a CAT B30 phone.

This is a spalsh-proof and shock-proof phone for rough handling, which is not a feature I need, but at least it meant that they weren't going for a fancy modern but unusable interface. I haven't used that phone enough to be able to tell how good it is. I know it won't be perfect (eg. it seems that the calendar will be hard to use for an entirely different reason: I can't configure it to display weeks with Monday first, and I never look at headings, I just assume the date number in the leftmost column means Monday), but it seems at least better than the Nokia 216.

So I had to figure out how to move the contact list to the CAT B30 phone.

This one looked easier. This phone actually also uses the vcard format, which sounded promising. I transferred the backup file from the Nokia 216 to the CAT B30 through Bluetooth on the subway ride first. That turns out to not work, because while both the Nokia 216 and the CAT B30 has a file browser that allows you to send files through Bluetooth or move or rename them, the rename function doesn't allow you to change the file extension, the Nokia 216 only writes contacts into files into "Backup\backup.dat", and the CAT B30 reads contacts from files with the extension ".vcf" anywhere on the card.

So I renamed the file extension on the SD card with a computer using the remote disk feature through an USB cable. That gets closer, but still doesn't work: you get the phone numbers imported, but the names are wrong whenever there's any character MIME-quoted in the vcard file, and even spaces are MIME-quoted, so basically all the names are wrong.

But I could fix the file format with a perl script in just one try this time.

Copy the file from the Nokia 216 to the computer. Here I used the default filename "backup.dat" (I actually save the backups in more sensible names including a date so I can distinguish backups, but this is just an example). Get the backup rewritten with this one-liner:

perl -we 'while (<>) { if (/^\r\n\z/) {} elsif ($c) { $c=0; /^(.*);;;\ +r\n\z/ or die "nc $_"; $f=";CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE:" +; print "N$f;$;$1;;;\r\nFN$f$1\r\n"; } elsif (/^N;/) { /^N;ENCODING=Q +UOTED-PRINTABLE;CHARSET=UTF-8:;=\r\n\z/ or die; $c=1; } elsif (/^TEL; +/) { /^TEL;[A-Z]+;(CELL:[+0-9#*p]+)\r\n/ or die qq(tel $_); print "TE +L;CELL:$1\r\n"; } elsif (/^(BEGIN:|VERSION:|END:)/) { print } else { +die "parse $_" } }' backup.dat > backup.vcf

This outputs the records in the correct format for the CAT B30:


Copy the output file ("backup.vcf") onto the CAT B30, and this time you can use any filename and any directory, as long as the extension is ".vcf". Delete the existing phone numbers from the contacts list, because the CAT B30 doesn't do this automatically, it merges the contact list. Then import the contacts from the contacts menu by selecting that file on the SD card.

(This script doesn't handle assigning the custom ringtones to family members directly, I'll set those directly in the phone.)

  • Comment on Migrate phone numbers from Nokia 6303c to Nokia 216 then to CAT B30, or the quest for a sane phone
  • Select or Download Code

Replies are listed 'Best First'.
Re: Migrate phone numbers from Nokia 6303c to Nokia 216 then to CAT B30, or the quest for a sane phone
by stevieb (Abbot) on Nov 06, 2018 at 22:30 UTC

    This isn't just a Cool Use of Perl, it's a story of sadness, frustration, anger, diligence, persistence, perseverance and honesty.

    ...all in a single post. Kudos, and nice job!

Re: Migrate phone numbers from Nokia 6303c to Nokia 216 then to CAT B30, or the quest for a sane phone
by Theodore (Pilgrim) on Nov 07, 2018 at 11:47 UTC
    Given the state of things concerning mobile phones (feature phones and smart phones) right now, I have been really tempted to get the cheapest feature phone available and use a paper booklet for contacts list and calendar. The only thing that keeps me from doing that is that I will look like a hipster when trying to make a call.

      That is more or less what I was trying to do when I started using the Nokia 216. It's not technically the cheapest feature phone available, but it is rather cheap. I even wrote calendar data on paper for a while, although I haven't started to use a paper booklet for my own contacts. The CAT B30 isn't the cheapest, but I looked at a cheaper feature phone actually, and decided that I don't want that one after trying its interface out a bit in a store.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: CUFP [id://1225327]
Front-paged by stevieb
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2018-11-14 21:49 GMT
Find Nodes?
    Voting Booth?
    My code is most likely broken because:

    Results (177 votes). Check out past polls.