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
499 stars 208 forks source link

Add support for North Macedonia TIN #330

Closed unho closed 2 years ago

unho commented 2 years ago

Note that this is implementation is mostly based on unofficial sources describing the format, which match the hundreds of examples found online.

Also note that the algorithm for the check digit was tested on all found examples, and it doesn't work for all of them, despite those failing examples don't seem to be valid according to the official online search.

Closes #222.

unho commented 2 years ago

@arthurdejong I really don't understand why this test fails. Maybe you can shed some light?

arthurdejong commented 2 years ago

Thanks @unho for providing this. I've modified the stripping of the "MK" prefix to work with ASCII, Cyrillic, Python 3 and Python 2 (both unicode strings as well as bytestrings). It turns out that bytestring(unicodestring) doesn't work in all cases in Python 2.

Merged as a261a93

unho commented 2 years ago

@arthurdejong Thanks a lot for the adjustments!