global_phone
global_phone copied to clipboard
Local phone number formatting issue
The national_format returns wrong results in many cases:
GlobalPhone.parse('+4372762580').national_format
=> "0727 62580"
(correct: 07276 2580)
GlobalPhone.parse('+49907896890').national_format
=> "090 7896890"
(correct: 09078 96890)
I think that the problem is not caused by wrong rules in the DB since libPhoneNumber-iOS yields correct results.
Look at pull request #9
I didn't mean the double white space which is easy to fix. I meant the wrong position of the space.
@futuretap - confirmed using a freshly created global_phone.json (even with the whitespace fix of #9).
I've never tried to understand how the json is being generated, but perhaps there's some information lost when parsing the original xml. I notice a bit of a difference in size (even taking in to account comments and xml bloat).
diff -u <({curl -silent http://libphonenumber.googlecode.com/svn/trunk/resources/PhoneNumberMetadata.xml, global_phone_dbgen} | wc -l)
- 24710
+ 6659
You could look at the c# port. I've modified the code to generate a bit more readable json : https://github.com/wallymathieu/GlobalPhone/commit/6eb4eb579ec1d7d740c03da3b3a3dc25a4cc9a19