How to cannonicate numbers in international form

Tilman Baumann tilman at
Thu Jul 17 22:14:25 CEST 2008

Am 17.07.2008 um 21:30 schrieb Werner Almesberger:

> Joachim Breitner wrote:
>> uff, this is bad.
> Yeah ;-)

I would have  never expected anything so bizarre.

> * -> 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.)

I don't hink matching numbers from the right is a good idea in any way.
And to be completely honest, i don't think screwing a 99% working dial  
plan for any completely broken numbering system as this would be a  
good choice.

We could make some blacklist for these known broken countries and hand  
crafted code for these irregularities.

I assume you could even in Buenos Aires dial 15-xxxx-xxxx OR +54 9 11  
xxxx xxxx?
So what we need to do to transform these numbers is just
	$number =~ s/^15/+54911/;

No big deal.
Well, and maybe some SMS hack.
> 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 :-)

But way resort to such methods if the only reason is some crazy corner  

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

Well, if you (as a user) can not provide these data (because you don't  
understand it) you just have to live without the benefits. No big loss.


More information about the devel mailing list