2

I have a web application that needs to support international numbers, since many countries format numbers differently and don't always have 10 digits what is the best way to format the numbers when displaying them?

For instance, the US formats numbers as such: (xxx) xxx-xxxx

France: 0 xxx xxx xxx

UK: (01xxxx) xxxxx

What is the best practice for displaying phone numbers from different countries? Should they be displayed the US way? Should it be displayed in the way the country of origin displays it? Or should users be allowed to format the number themselves within the textbox themselves?

  • 2
    If you're displaying international numbers then I assume you already know the dialing code for those numbers (i.e. +44 for UK). In that case can't you extrapolate the correct format based on the international dialing code? – JonW Jun 25 '15 at 12:50
  • While this is possible, users are allowed to enter multiple numbers, and often times these numbers will come from different countries. If all numbers are displayed at once, should one standard format of displaying these numbers be shown, or should each individual number have their own formatting? – Benjamin Jun 25 '15 at 12:55
  • @Benjamin if you have the capability of showing each number in their own format I would certainly do that, if the user enters a number in UK format and then its displayed in US format it could be very confusing. – DasBeasto Jun 25 '15 at 12:58
  • @DasBeasto What about users, say who are from the United States, are viewing information regarding Company XYZ that is based in France, but has not only a United States phone number, but also a France and UK phone number. Company XYZ is only allowed to post their numbers (they cannot post notes regarding said phone numbers [i.e. For US numbers use phone number x]). The numbers are then displayed in a list format for other users to see. Can't this be confusing for some users? – Benjamin Jun 25 '15 at 13:10
1

Collect phone numbers as a single string

Ultimately a phone number is just a string of letters and/or numbers so in general a single text input should be used when asking a user to enter their phone number.

The application can then validate the user input and ask for clarification if needed.

An example of interpreting a user entered phone number

enter image description here


Display phone numbers as the user input

If you display phone numbers the same way it was entered then a user can edit it on their own.

  • 1
    Yes please this! This allows for all i18n weirdness, grouping for comfortable reading etc. Downside, however: operators must be trained (or guided) to enter full phone numbers e.g. with country + area code. Lists generated from this data without additional formatting may look ugly and unprofessional. Modern online services are way ahead of every static library in figuring out how to dial such a number - butthat's not an option wihtout internet connection. – peterchen Jun 25 '15 at 14:50
  • How should extensions be handled? In the example provided the letters Ext. are considered numbers. – Benjamin Jun 25 '15 at 15:36
  • @Benjamin that's a great point. I would look for patterns such as x2242 or Ext. 2242 and make an educated guess. These are cases that may require a second verification step. I would still display whatever the user typed x, ext, etc. – DaveAlger Jun 25 '15 at 16:23
  • I'll try and update that demo with this extra verification step when I have more time – DaveAlger Jun 25 '15 at 16:25
3

Two common alternatives:

  1. If you want to present international numbers using a common (same) format, then the United Nations ITU E.164 standard is a good way to do it.

    enter image description here

  2. If you are willing to code a little, then presenting numbers in the user's locale format can be more readable.

    • Google provides an excellent and wideley used/tested library -- libphonenumber -- which can parse and validate phone numbers in a wide range of formats, and output them in E.164 or locale formats.

    • The library has been ported to many different languages/environments, just follow the link.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.