Re: This shouldn't happen
Yes, you format it for storage. Every time a user enters a number, and every time you store that in the database, and every time you want to search, or bulk import data.
This means validating and coercing the data into this format every time it is entered. In one way this is very little different to any other UI validation (for example NHS numbers with or without spaces), but it is common enough for numbers to be supplied in all one format, or all another, or in a mixture, that code to address the situation seems to crop up time and again.
For example, we have one system that lets users enter a mobile number, in the 07... format, and some of this data is then fed into another system that generates and sends SMS messages, via a third-party provider, which wants it in the +44 format. I can't recall whether they want the + on the front or not, I have it in the back of my head what they actually require is 447...
This stems from the fact that there is a "formal representation" of the number, and there is the colloquial use. In the UK, if we were calling someone, we wouldn't type +447... into our phones, we'd dial 07...
We'd also quite often insert spaces, certainly when reading a number. For example, my own number starts with 07733, and when reading it to someone I would quote it as 07733 nnn nnn.
In France, however, they read numbers in pairs, and would read my example above as 0 71 23 45 67 89, "zéro, cinquante-onze, vingt-trois, quarante-cinq, soixante-sept, quatre-vingt-huit" and would be likely to write it down, and enter it into any computer system that allows it as such. In the US, they like to insert dashes into numbers, and so-on.
If you're storing the number in a database and then not actually using it for anything beyond retrieval, then you're unlikely to go to the trouble of normalising it (got a user story for that?), but if you are searching for it, you probably do want to normalise it, and also try to normalise your search terms. But what if you wanted to search for numbers that have "23 45 67" in the (including the spaces in those positions)? The seemingly simpleness of the situation belies a fair amount of complexity.