global_phone icon indicating copy to clipboard operation
global_phone copied to clipboard

Local phone number formatting issue

Open futuretap opened this issue 11 years ago • 4 comments

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.

futuretap avatar Jul 23 '14 09:07 futuretap

Look at pull request #9

wallymathieu avatar Dec 04 '14 06:12 wallymathieu

I didn't mean the double white space which is easy to fix. I meant the wrong position of the space.

futuretap avatar Dec 04 '14 09:12 futuretap

@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

locochris avatar Dec 04 '14 22:12 locochris

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

wallymathieu avatar Dec 05 '14 06:12 wallymathieu