evermeer/PassportScanner

How to validate 3-lines MRZ?

Closed this issue · 4 comments

Hello @evermeer, awesome work!

I met the challenge - how to validate second line of triple-lined MRZ.
I saw the wikipedia but there is no exhaustive info about how to do that.
And other question... in your MRZ.swift i saw that you extract passportNumber like two leading letters and other is numbers.. where you found this format? I want the same explanation for document number for triple-lined MRZ's.

Thanks in advance!

Doing a 3 line MRZ code is also on my wishlist. See #5

For the password MRZ I was able to create the logic based on what was described on wikipedia. See https://en.wikipedia.org/wiki/Machine-readable_passport as you can see there is also a description for official travel documents with 3 lines. That should be enough information.

@evermeer in wiki is written that passport number consist of alpha+num+< but in your code for passport number there is only two leading characters satisfying this condition, other chars is numbers. Code snippet:
passportNumber = line2.subString(0, to: 1) + line2.subString(2, to: 8).toNumber()
Where you obtained this info?

The only reason why I did that is to clean up the last part of the number. The .toNumber() function will replace none numeric characters to numeric characters that look similar. So it will replace an O with an 0. I believe in all cases (I'm not 100% sure) only the first 2 characters can be alphanumeric. So those are not cleaned up.

Closing this since the actual 3 line MRZ issue is registered here: #5