From 1fa84183243126b4b12f0da520f66a8e49e3c59c Mon Sep 17 00:00:00 2001 From: mandlil <138015259+mandlil@users.noreply.github.com> Date: Wed, 18 Oct 2023 11:53:54 +0530 Subject: [PATCH 1/3] Parsing issue with "(8108) 6309 390 906" (RU) while parsing the number the first 3 digits are discarding, due to that it is giving the wrong country code as "86". --- .../src/com/google/i18n/phonenumbers/PhoneNumberUtil.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java b/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java index 1f49d6747..e5133f8b7 100644 --- a/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java +++ b/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java @@ -2876,6 +2876,9 @@ public class PhoneNumberUtil { String possibleCountryIddPrefix = "NonMatch"; if (defaultRegionMetadata != null) { possibleCountryIddPrefix = defaultRegionMetadata.getInternationalPrefix(); + if ( defaultRegionMetadata.getId().equals("RU") && possibleCountryIddPrefix.contains("810")) { + possibleCountryIddPrefix = "00"; + } } CountryCodeSource countryCodeSource = From 1564ec20536883f6fb7c9d3aa893912d5b042ece Mon Sep 17 00:00:00 2001 From: mandlil <138015259+mandlil@users.noreply.github.com> Date: Tue, 31 Oct 2023 13:52:22 +0530 Subject: [PATCH 2/3] Parsing issue with "(8108) 6309 390 906" (RU) --- .../src/com/google/i18n/phonenumbers/PhoneNumberUtil.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java b/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java index e5133f8b7..bb32de77e 100644 --- a/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java +++ b/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java @@ -2877,7 +2877,9 @@ public class PhoneNumberUtil { if (defaultRegionMetadata != null) { possibleCountryIddPrefix = defaultRegionMetadata.getInternationalPrefix(); if ( defaultRegionMetadata.getId().equals("RU") && possibleCountryIddPrefix.contains("810")) { - possibleCountryIddPrefix = "00"; + if (new String(fullNumber).startsWith("8108")) { + possibleCountryIddPrefix = "00"; + } } } From cf4a21a28b7775997c1dcace77c7191a898a52e6 Mon Sep 17 00:00:00 2001 From: mandlil <138015259+mandlil@users.noreply.github.com> Date: Tue, 31 Oct 2023 17:04:34 +0530 Subject: [PATCH 3/3] changes if condition for the prefix --- .../src/com/google/i18n/phonenumbers/PhoneNumberUtil.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java b/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java index bb32de77e..f42c76068 100644 --- a/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java +++ b/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java @@ -2876,11 +2876,9 @@ public class PhoneNumberUtil { String possibleCountryIddPrefix = "NonMatch"; if (defaultRegionMetadata != null) { possibleCountryIddPrefix = defaultRegionMetadata.getInternationalPrefix(); - if ( defaultRegionMetadata.getId().equals("RU") && possibleCountryIddPrefix.contains("810")) { - if (new String(fullNumber).startsWith("8108")) { - possibleCountryIddPrefix = "00"; - } - } + if (defaultRegionMetadata.getId().equals("RU") && new String(fullNumber).startsWith("8108")) { + possibleCountryIddPrefix = "00"; + } } CountryCodeSource countryCodeSource =