arthurdejong / python-stdnum

A Python library to provide functions to handle, parse and validate standard numbers.
https://arthurdejong.org/python-stdnum/
GNU Lesser General Public License v2.1
484 stars 203 forks source link

Incorrect validation results for Chinese ID cards, some specific area codes cannot pass validation #442

Open moe001 opened 1 month ago

moe001 commented 1 month ago

For ID card numbers starting with 412723, they are indeed valid in reality, but this library considers them invalid. This area code is no longer in use due to some administrative adjustments, but people born before the change still have ID numbers starting with this code. Therefore, there are still a large number of people with ID numbers starting with this code.

Example: This official announcement clearly shows many ID numbers starting with this code (http://zrzyhghj.xuchang.gov.cn/xxgg/013002/20190822/b1eab7b9-b5d1-4405-83bc-c32cc0ace220.html)

arthurdejong commented 1 week ago

Thanks for reporting this. Do you know if there is a list of historic area codes that are considered valid? The list of locations is currently taken from https://github.com/cn/GB2260 I can't read Chinese so I read things via Google Translate which is far from ideal.

Validating the location part of the number is really nice because it greatly limits the numbers that are considered valid. If there are just a handful of old area codes I can add them to a separate list but if there are many the location verification should probably become optional.