How to cannonicate numbers in international form

Werner Almesberger werner at openmoko.org
Thu Jul 17 22:57:23 CEST 2008


Tilman Baumann wrote:
> I would have  never expected anything so bizarre.

:-)

> I don't hink matching numbers from the right is a good idea in any way.

Matching from the right would tell you what numbering plan applies.
You'd match the actual number from the left. Caveat: internal numbers
that are dialed along with the normal number.

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

I'm not sure how many exceptions you'll need in the end. I would
expect similar issues to exist in other countries that don't have a
uniform national numbering plan, except perhaps that "magic" 9.

Then add fun stuff like carrier selection and such. It does get
ugly.

> I assume you could even in Buenos Aires dial 15-xxxx-xxxx OR +54 9 11  
> xxxx xxxx?

Yes.

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

You still need it if you want to handle different-length local parts.
The cost of making it flexible doesn't seem to be be particularly high,
and you could always use something like "last 7 digits" as the default
rule.

- Werner




More information about the devel mailing list