emostar / flutter-libphonenumber

libphonenumber plugin for Flutter
MIT License
47 stars 50 forks source link

Bug while parsing +17345465 #40

Open abhinavsingh opened 3 years ago

abhinavsingh commented 3 years ago

libPhoneNumber.parse("+17345465") returns {international: +1 268-734-5465, national: (268) 734-5465, type: mobile, e164: +12687345465, country_code: 1, national_number: 2687345465}.

Unsure from where does 268 comes from. We haven't seen this behavior with any other number.

Can someone explain the rationale here?

Thank you

abhinavsingh commented 3 years ago

I read further about flutter-libphonenumber. Looks like it doesn't re-use existing native library but is an implementation of it's specification. Clearly there are some edge cases not taken cared of.

Example, here is a result from Python libphonenumber which underneath uses native lib. Same issue is not reproducible there.

>>> import phonenumbers
>>> phonenumbers.parse("+17345465")
PhoneNumber(country_code=1, national_number=7345465, extension=None, italian_leading_zero=None, number_of_leading_zeros=None, country_code_source=0, preferred_domestic_carrier_code=None)