Support for Code39 MOD43 checksum?

145 views
Skip to first unread message

Brad Whitlock

unread,
Jan 27, 2015, 3:51:45 PM1/27/15
to zx...@googlegroups.com
I just ran into a set of barcodes that use the optional MOD43 checksum on the Code39 barcodes. (More info at e.g. http://idautomation.com/barcode-faq/code-39/#MOD43 .) The other systems that use these barcodes process and use the checksum to check for a valid scan, and do not return it with the data. The handheld scanner I have can be configured to do that as well.

I did not find an option in the Zxing Barcode Scanner app for Android (V. 4.7.0) to use this as a checksum, instead it returns the checksum as part of the data. This is correct behavior for scanners that do not process the checksum internally.

Could support for this optional Code39 checksum be added? It would have to be manually set, as there is no way from the barcode to know if the last digit is a checksum of the data, or part of the data.

Lachezar Dobrev

unread,
Jan 27, 2015, 4:55:48 PM1/27/15
to Brad Whitlock, zxing
There is support for Code39 check digit validation.
The Reader needs to be created with the appropriate flags, or if
using the MultiFormatOneDReader there is a Hint
DecodeHintType.ASSUME_CODE_39_CHECK_DIGIT that can be supplied to
instruct the Multi-Format reader to use a Code39 reader with
check-digit validation.
Depending on the way you use the ZXing scanner the method of
supplying that hint would be different.

* Intent integration: just add an Extra to the Intent with the name
of "ASSUME_CODE_39_CHECK_DIGIT"

* Web Page integration: add an "ASSUME_CODE_39_CHECK_DIGIT" query
parameter to the zxing://scan/ or http://zxing.appspot.com/scan URL

* Apparently there is no way to send intent extras when using
IntentIntegrator from the android-integration project, but you can
sub-class it, override the startActivityForResult(Intent intent, int
code) method and add an Intent Extra with the
"ASSUME_CODE_39_CHECK_DIGIT" and any value.

HTH
> --
> You received this message because you are subscribed to the Google Groups "zxing" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to zxing+un...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Sean Owen

unread,
Jan 27, 2015, 4:58:20 PM1/27/15
to zx...@googlegroups.com
Yes, this is what DecodeHintType.ASSUME_CODE_39_CHECK_DIGIT is for. You can use it if calling as a library, or I think with Intents too. the problem is there is no way to know from looking at the barcode whether it's meant to have a check digit or not, and the default in the app is simply to assume there is none.

Brad Whitlock

unread,
Jan 30, 2015, 11:19:47 PM1/30/15
to zx...@googlegroups.com, brad...@gmail.com
Thanks, that explains it, though I'm not in a position to write code calling the engine, it's good that it's there. I understand that the scanning engine has to be told whether there's a check digit or not. Is that a setting that can be different on each call to the engine, or is an app using it fixed in either processing check digits or not?

If it's call-by-call, could the Barcode Reader app include a Setting to turn it on and off? I use that app as a backup to my work scanner on occasion.

I was able to use the web page integration to scan with the check digit assumed, and it worked--mostly. The barcodes I had with check digits "$/+%" were not scanned. Check digits of ".", numerics, and space worked correctly. This sounds like a bug? Known issue?
Reply all
Reply to author
Forward
0 new messages