ruimarinho / google-libphonenumber

The up-to-date and reliable Google's libphonenumber package for node.js.
https://ruimarinho.github.io/google-libphonenumber
Other
1.39k stars 144 forks source link

parsing issue for specific German numbers #339

Closed dovlet-audibene closed 2 years ago

dovlet-audibene commented 2 years ago

There are some mobile phone numbers with less digits in Germany and I can not parse them. Any idea will be very helpful. Please check my code below:

        PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance();
        Phonenumber.PhoneNumber phoneNumber = phoneUtil.parse("491786730511", "DE");

        String formattedNumber = phoneUtil.format(phoneNumber, PhoneNumberUtil.PhoneNumberFormat.E164);

        assertEquals("+491786730511", formattedNumber);

And the result is: org.opentest4j.AssertionFailedError: Expected :+491786730511 Actual :+49491786730511 Thank you :)

ruimarinho commented 2 years ago

If you look at https://libphonenumber.appspot.com/phonenumberparser?number=491786730511&country=DE, everything looks good. Are you using the latest version of the library?

dovlet-audibene commented 2 years ago

Hello, thank you for sharing that with me.

If you can look at the formatting result:

E164 format +49491786730511

The result number formatted incorrectly. It's not valid number. Country code is duplicated. It's +49491786730511, but should be +491786730511.

Best, Dovlet


From: Rui Marinho @.> Sent: Wednesday, July 27, 2022 10:50 AM To: ruimarinho/google-libphonenumber @.> Cc: Dovlet Annayev @.>; Author @.> Subject: Re: [ruimarinho/google-libphonenumber] parsing issue for specific German numbers (Issue #339)

If you look at https://libphonenumber.appspot.com/phonenumberparser?number=491786730511&country=DEhttps://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flibphonenumber.appspot.com%2Fphonenumberparser%3Fnumber%3D491786730511%26country%3DDE&data=05%7C01%7Cdovlet.annayev%40audibene.de%7Ce4f3c1d19fcc446681f508da6fad128a%7C51834058d59b46ca8d10e86de9ee892d%7C0%7C0%7C637945086401786630%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=LlM7p6vnRtdlchnFL9RGWY%2BcPWRF5FeuLVUj9yovcmI%3D&reserved=0, everything looks good. Are you using the latest version of the library?

— Reply to this email directly, view it on GitHubhttps://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fruimarinho%2Fgoogle-libphonenumber%2Fissues%2F339%23issuecomment-1196442950&data=05%7C01%7Cdovlet.annayev%40audibene.de%7Ce4f3c1d19fcc446681f508da6fad128a%7C51834058d59b46ca8d10e86de9ee892d%7C0%7C0%7C637945086401786630%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Sl9vQy2PBbLMxvxa7d%2FCkBZnvMBpjP7UBux%2Fa12zOMQ%3D&reserved=0, or unsubscribehttps://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAP2XPNDFIUTSVO6SJTZJZY3VWDZ5VANCNFSM5ZCGJCJA&data=05%7C01%7Cdovlet.annayev%40audibene.de%7Ce4f3c1d19fcc446681f508da6fad128a%7C51834058d59b46ca8d10e86de9ee892d%7C0%7C0%7C637945086401786630%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=bgVnJiXS41oTTHjWrwP1nt18JXNayD0mMoiwCeJzbkk%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.***>