swa66 - 8:27 am on Sep 13, 2012 (gmt 0)
Now all you need to do upon output is format it in a way the user seeing it is expecting the phone number to be formatted (might be locale or use specific (local numbers/ international exit code / ...)
The big advantage is that you have a specific and generic format in your database.
input -> stored
1-800-flowers -> 18003569377
+32/4184.108.40.206 -> 32485111111
Now as you learn locations, you learn mistakes people make on input, correct those.
E.g. some people assume because their internationel exit code is 00, that that is the case everywhere -> correct it.Or if you know that there is a discrepancy between (foolish) local traditions and actual numbers one can dial, you can correct it too:
00324220.127.116.11 -> 32471111111
+32(0)418.104.22.168 -> 32491111111
You can also add back missing info by e.g. adding back in the country code from an address:
Belgium 011/11.11.11 -> 3211111111
USA (212)555-5555 -> 12125555555
Be careful with checking lengths: e.g. in Germany (just like in Belgium) the length of a phone number is not fixed. And some countries have such a small population that their phone numbers look suspiciously short.
On output: if you know what/where it is going to be used, you can either output locally written numbers or a full international one as appropriate.
I've run multiple times into an application that is too US centric to be used properly and demanding a phone number in a US format - they'll usually end up with a fake one is they insist on not accepting my real one.