hbb20 / CountryCodePickerProject

Country Code Picker (CCP) is an android library which provides an easy way to search and select country or international phone code. Also supports Android EditText phone mask and international phone validation.
Apache License 2.0
1.52k stars 505 forks source link

Russian Federation phone number automatically detected as Kazakhstan #510

Open ElizavetaGorbunova opened 3 years ago

ElizavetaGorbunova commented 3 years ago

Russian Federation and Kazakhstan have the same dialing code +7. Anyway, the country can be distinguish by DEF code. DEF code for Kazakhstan is 6XX or 7XX. For Russian Federation, I don't see strict rules.

Here is the case when country is detected as Kazakhstan when it is Russian Federation:

Preconditions

  1. Select Russian Federation manually
  2. Enter valid phone number: +7 913 XXX XX XX
  3. Save phone number. In my case, it is sent to the backend

Steps to reproduce

  1. Put saved phone number in the widget without adding Russian Federation to preferredCountries

Result : Kazakhstan detected Expected result: Russian Federation detected

I assume Kazakhstan is selected by default because of the alphabet order.

AlexSuvorov2k commented 2 years ago

You can set Russia like this: country_picker_view.setCountryForNameCode("ru")

vhartikainen commented 5 months ago

getCountryForNumber(context, getCCPLanguageFromLocale(context), "+7921xxxxx") -> KZ.

This is clearly a bug