Comments (6)
Thank you for the response,
Take your time when you can, I will make a workaround based on your response in the meanwhile.
Thanks again for supporting this project and keep up the good work.
Best regards.
from mrz.
Hi!
I don't know if I understand you..
IIf I remember correctly, all countries codes have 3 letters with two exceptions: United Kingdom "GB"
and Germany "D"
and both work correctly
For example:
from mrz.checker.td1 import TD1CodeChecker
print(TD1CodeChecker("ID<GB0000000000000000000<<<<<<\n"
"8001014F2501017<GB<<<<<<<<<<<4\n"
"SAMPLE<SAMPLE<<SAMPLE<SAMPLE<<"))
print(TD1CodeChecker("ID<<D0000000000000000000<<<<<<\n"
"8001014F2501017<<D<<<<<<<<<<<4\n"
"SAMPLE<SAMPLE<<SAMPLE<SAMPLE<<"))
Output
True
True
Can you give an example?
Thanks
from mrz.
Thank you for a quick response. I get an error with Slovenian ID, that has a two letter country code SI
. Slovenian passports work as expected as they have three letter country code SVN
.
from mrz.
Sorry.. I read your message days ago but i forgot to reply to you.
I was planning to give you the standard answer. "ICAO specifications says": All countries use 3-letter codes, so "this is outside the scope of the project. Therefore it's a special case" and then I would quote specs.
But reviewing the specs i read:
The following are the two- and three-letter codes for entities specified and regularly updated in [ISO 3166-1], with
extensions for certain States and organizations being identified by an asterisk. The current version of the codes may be
obtained from the [ISO 3166] maintenance agency - [ISO 3166/MA], ISOβs focal point for country codes.
Specs are specs, so it's within the scope of this project.
The good news is that I envisioned something for something similar to your request:
def country(string, dictionary=countries.english):
if check_string(string) and string.upper() in dictionary.values():
return string.upper().ljust(3, "<")
elif full_capitalize(string) in dictionary.keys():
return dictionary[full_capitalize(string)].ljust(3, "<")
else:
raise CountryError(cause=string)
(See dictionary kwarg)
Bad news is that I now have very little free time. However, all this it's pending.
As this is something that requires a lot of changes, I promise to provide a temporary special case in a few days (a special case for Slovenian TD1s)
BR
from mrz.
I just stumbled over the same issue (on the checker side).
The quick and dirty fix is to add
"Slovenia2": "SI",
to base/countries.py
.
However, this might be a bit of a moving target, so I'd suggest to ultimatively not flag unrecognised countries as errors at all but to just pass them through. Or perhaps add a verify_country=True to the checker to disable the country check if you don't really need it?
from mrz.
The even easier quick hack is to add
# Patch up MRZ module for special cases
from mrz.base.countries import english
english["Slovenia2"] = "SI"
to you application, that way one doesn't have to touch the original mrz distribution files.
from mrz.
Related Issues (20)
- Code not executed after checker returns False HOT 4
- Error while running file
- Mrz on windows: very slow the 1st time only HOT 1
- Optional data hash is checked even if optional data is empty HOT 10
- Issue with georgia passports (td1) HOT 2
- Add callback to optionally "repair" fields HOT 5
- Undefined variable 's' in Precheck method HOT 2
- NLD ID optional data hash HOT 2
- README before creating an issue or asking by email HOT 1
- Installation error: pip install mrz HOT 1
- Empty optional data field and empty optional data hash in TD3 format will result in a invalid hash in the TD3CodeChecker HOT 1
- parser: Document number checksum on Estonian ID Cards is "<" HOT 1
- No module named 'examples.functions' HOT 1
- Wrong country code for Interpol
- Does code take into account some (US) passports have 5-6 check digits at the end of line 2?
- For TD3 checker, Name is blank if surname not present in MRZ text
- how to generate image HOT 3
- Mrz
- Tutorial how to use?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mrz.