IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New The only thing you can assume
Is that there is a country code and then the rest of the number. That's it. You cannot assume that it is all numbers (1-800-FLOWERS) you cannot assume 3 digit area codes, seven digit numbers, or anything else like that. You can perhaps split out the extension. So you can have country code (3 digits), phone number (I'd provide 20 characters), and an extension - allow 7 characters.

I wouldn't bother to do any kind of formatting of the numbers at all. Let the person who enters the number provide the separators.



"Whenever you find you are on the side of the majority, it is time to pause and reflect"   --Mark Twain

"The significant problems we face cannot be solved at the same level of thinking we were at when we created them."   --Albert Einstein

"This is still a dangerous world. It's a world of madmen and uncertainty and potential mental losses."   --George W. Bush
New Have to disagree with that one
The formats you know, your classes should do validation. There's no point in storing a 6-digit number that is supposedly for the U.S.
===

Purveyor of Doc Hope's [link|http://DocHope.com|fresh-baked dog biscuits and pet treats].
[link|http://DocHope.com|http://DocHope.com]
New It would be a LOT of work
and I know of no library that is comprehensive.

Best not to do any rather than appear stupid.

Besides, the value of "validation" is limited - its not like a little set of heuristics is actually gonna guarantee that the number actually WORKS or anything.

I figure you're no worse off.



"Whenever you find you are on the side of the majority, it is time to pause and reflect"   --Mark Twain

"The significant problems we face cannot be solved at the same level of thinking we were at when we created them."   --Albert Einstein

"This is still a dangerous world. It's a world of madmen and uncertainty and potential mental losses."   --George W. Bush
Expand Edited by tuberculosis March 27, 2005, 11:31:45 PM EST
New No, Todd is right
Just take Italy for example. Phone numbers there can be either 9 or 10 digits including area code -- I'm not sure if more variations are possible, but I've seen these two variations.

IIRC, area codes used to be two digit (say before 1998), but are now three digit.

So you can't make assumptions, and the rules can change over time.

Tony
New Re: The only thing you can assume
You cannot assume that it is all numbers (1-800-FLOWERS) you cannot assume 3 digit area codes, seven digit numbers, or anything else like that.

Depending on what you are doing you may want to ban letters entirly. Keypad letter to number mappings vary somewhat across countries, and even slighly inside the US.

You can perhaps split out the extension. So you can have country code (3 digits), phone number (I'd provide 20 characters), and an extension - allow 7 characters.

20 is probably over kill, I think the standard limits the country internal part of phone numbers to 10 digits. Even allowing some leway for dashes and space for possible future expansion, 20 is probably excessive. Of course, if your doing the sane thing and dropping it in a varchar there is no reason to limit it at the database level. And on the other hand, for some applications even 20 would not be enough. I use a calling card for long distance calls, if I'm programming that into a system to make outbound calls it's going to be an 800 number, followed by my card number, followed by the actual number I'm trying to dial.

I would make the space for extension longer. I often put the keys to navigate menus in the extension field to keep it handy. With some of the hosting companies I've dealt with it's an extension, followed by mulitple levels of touch pad menu.

I guess the ultimate point here is that it isn't enough to say your storing phone numbers. How much space you need and what you want to allow in the phone number depends partially on what the number is going to used for.

Jay
     Phone numbers and i18n - (Yendor) - (39)
         Only thing I would question - (jake123)
         If you want to make your display useful - (Arkadiy) - (3)
             What else could you store it as? -NT - (drewk)
             Re: If you want to make your display useful - (Yendor) - (1)
                 Country code, area code, main number, extension -NT - (Arkadiy)
         Re: Phone numbers and i18n - (JayMehaffey) - (1)
             Re: Phone numbers and i18n - (Yendor)
         Basically, you're totally wrong, and your colleague right. - (CRConrad) - (22)
             American users are helped by it - (drewk) - (17)
                 In Charlotte, and surrounding area,... - (a6l6e6x)
                 No - (tuberculosis) - (15)
                     True, if everything's 10-digit no need for the '1' -NT - (drewk)
                     the leading one is to route to a stp for long distance - (boxley) - (2)
                         I know why its there - (tuberculosis) - (1)
                             duh, forgot about that :-) - (boxley)
                     Here too - (SpiceWare)
                     Well, (probably because I'm a contrarian) - (jb4) - (9)
                         Note on "overlaid" area codes. - (static) - (8)
                             Houston did both - (SpiceWare) - (7)
                                 Sounds like they didn't give enough notice. - (static) - (1)
                                     wasn't much - (SpiceWare)
                                 Re: Houston did both - (JayMehaffey)
                                 The reason our "Bell system" will NEVER increase... - (jb4) - (3)
                                     rule of 7 is long gone - (SpiceWare) - (2)
                                         Yes, of course - (jb4) - (1)
                                             I think that rule is slightly faulty anyway. - (static)
             In A5a, it works like this. - (Another Scott) - (1)
                 wrt Canada - (jake123)
             Also, a11y. - (pwhysall)
             That's why you're an international linguist... - (jb4)
         I've had a little experience storing I18n phone numbers. - (static) - (3)
             Maybe you have to assume some level of user knowledge - (drewk) - (2)
                 Not to mention, having an International internal phone sys. - (folkert)
                 Definitely. - (static)
         The only thing you can assume - (tuberculosis) - (4)
             Have to disagree with that one - (drewk) - (2)
                 It would be a LOT of work - (tuberculosis)
                 No, Todd is right - (tonytib)
             Re: The only thing you can assume - (JayMehaffey)

Hatten ar din, hatten ar din. Hatten ar din, hatt baby!
76 ms