Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

National part of the number is truncated in some cases #76

Open
paulll opened this issue Jul 10, 2024 · 4 comments
Open

National part of the number is truncated in some cases #76

paulll opened this issue Jul 10, 2024 · 4 comments

Comments

@paulll
Copy link

paulll commented Jul 10, 2024

Some RU/KZ/BY (and maybe other) numbers are truncated if national part of the number starts with same digit as national trunk prefix which is 8 in that case:

  • for +78005553535 expected +78005553535, got +7005553535
  • for 88005553535 expected +78005553535, got +7005553535
  • for +375800111111 expected +375800111111, got +37500111111

Also RU numbers are always 11 digits in E164 form, so that +7005553535 is impossible number.

assert_eq!(
    parser::parse(Some(country::RU), "+78005553535").unwrap().format().to_string(),
    "+78005553535"
);

assert_eq!(
    parser::parse(Some(country::RU), "88005553535").unwrap().format().to_string(),
    "+78005553535"
);

assert_eq!(
    parser::parse(Some(country::BY), "+375800111111").unwrap().format().to_string(),
    "+375800111111"
);

Google libphonenumber handles that cases correctly: 1, 2, 3

@rubdos
Copy link
Member

rubdos commented Jul 10, 2024

Sounds like a duplicate of #68 to me, no?

@direc85
Copy link
Collaborator

direc85 commented Jul 10, 2024

Not quite, since this is about dropping a number in the national part, and bug 68 is about handling/guessing the country code in itself.

Edit: It is a duplicate indeed; this one drops 8 and the linked bug drops 39. Missed that one, sorry!

@paulll
Copy link
Author

paulll commented Jul 10, 2024

I'm not sure if it makes a difference, but as far as I can see, 39 is a country code:

<territory id="IT" mainCountryForCode="true" countryCode="39" internationalPrefix="00"
               mobileNumberPortableRegion="true">

And 8 is a national prefix, while 7 is a country code.

<territory id="RU" mainCountryForCode="true" countryCode="7" leadingDigits="3[04-689]|[489]"
               preferredInternationalPrefix="8~10" internationalPrefix="810" nationalPrefix="8"
               mobileNumberPortableRegion="true">

@rubdos
Copy link
Member

rubdos commented Jul 10, 2024

Let's leave both issues open, then!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants