How to cannonicate numbers in international form

Joachim Breitner mail at
Thu Jul 17 20:24:52 CEST 2008


Am Donnerstag, den 17.07.2008, 14:29 -0300 schrieb Werner Almesberger:
> Joachim Breitner wrote:
> > Hmm, I didn???t think of the areaCode, because, as far as I know, everyone
> > here always add the areaCode when using a cell phone. Is that different
> > in other places?
> E.g., in Argentina, Buenos Aires, you usually dial 15-xxxx-xxxx for
> mobile phones in the area, not including the area prefix. Worse yet,
> to call from abroad (or if you just want to use the fully qualified
> number), that number would become +54 9 11 xxxx xxxx, with 54 being
> the country code, 11 being the area, and 9 being some strange "this
> is a voice call to a mobile phone" selector. If you send an SMS,
> you omit the 9.
> I'm not sure this numbering plan is the worst you might encounter.
> Maybe people have been even more creative elsewhere ;-)

uff, this is bad. So can we still come up with code that tells us, for
numbers not in the GSM format (+4917212345), that they are _very likely_
the same?

For example, a very simple algorithm might be:
If the last 7 digits are the same, the numbers probably refer to the
same person?
This would catch
	+49172123456 vs. 0172/123 456
	+54 9 11 xxxx xxxx vs. 15-xxxx-xxxx
and a lot of other cases.

How likely will it give false positives? Assuming someone with a lot of
contacts (500), from many different countries (10), a rough calculation
gives a 2% chance that two of his contacts will have numbers that, when
compared according to this scheme (and not in GSM standard format) be
considered the same.

How likely will it fail? It will fail for very short numbers, where area
code (or operator prefix) + subscriber number is shorter than 7 digits.

I’d say this is a relatively good characteristic, then.

Tilman, I’m not suggesting to canonicate numbers _for user display_, not
at all. I only want my phone to be smart enough to be able to recognize
a number in non-standard form when I dial that or have it my contact
list. Therefore I’m not worrying about official or different standards.

Joachim Breitner
  e-Mail: mail at
  ICQ#: 74513189
  Jabber-ID: nomeata at
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : 

More information about the devel mailing list