How to cannonicate numbers in international form

Werner Almesberger werner at
Thu Jul 17 21:30:37 CEST 2008

Joachim Breitner wrote:
> uff, this is bad.

Yeah ;-)

> 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?

BTW, the numbering plan I mentioned is used with GSM.

> For example, a very simple algorithm might be:
> If the last 7 digits are the same, the numbers probably refer to the
> same person?

How about making it configurable, with rules depending on prefix and
"local zone(s)". E.g.,

* -> last six digits must match
+4121* -> last seven digits must match (i.e., landline, Vaud, Switzerland)
+5411* -> last eight digits must match (i.e., landline, Buenos Aires)
AR && 011* -> as above
BUE && 15* -> last eight digits must match (i.e., cellular, Buenos Aires)
(In fact, the last rule could just be "BUE", since all numbers here are
unique in their last eight digits.)

A number you know is only unique if the last N digits match would only
match any other number, no matter what you know about that one, if at
least N digits match.

In most cases, just a simple "n last digits match" test would be
sufficient. That's what all the usual phones do anyway, and false
matches are very rare. But hey, we can be more sophisticated :-)

By the way, I don't think requiring people to enter canonical numbers
is a good idea. When you travel, you often enough get numbers that
work if you dial them locally "as is", but you may not necessarily
have a good enough understanding of the local numbering plan to turn
them into fully qualified numbers.

- Werner

More information about the devel mailing list