Menu

#28 i2of5 check digit incorrect

open
nobody
None
5
2008-09-02
2008-09-02
No

It seems the the i2of5 check digit is wrong. You are considering the first digit even in Modulo10.java, and I think it should be considered odd.

http://barbecue.sourceforge.net/xref/net/sourceforge/barbecue/Modulo10.html

According to this page (and hardware scanners I've checked), the first digit it odd.
http://www.barcoderesource.com/i2of5_check_character.html

Your version of Modulo10.java produces 3 for the data 12345, it should be 7.

craig@crucw:/tmp $ java Modulo10 12345
> 0,1
> 1,7
> 2,10
> 3,22
> 4,27
3

By changing the true to false (see diff below), I get the correct value back.

craig@crucw:/tmp $ java Modulo10 12345
> 0,3
> 1,5
> 2,14
> 3,18
> 4,33
7

Seems like all i2of5 barcodes with check digits are wrong!! Perhaps all code that uses these two Modulo10 methods??

Note, I got the source I used in this test from the above sourceforge link.

Regards,

Craig O'Shannessy

craig@crucw:/tmp $ diff Modulo10.orig Modulo10.java
65a66
> System.out.println("> " + i + "," + sum);
94c95
< return getMod10CheckDigit(data, weightEven, weightOdd, true);
---
> return getMod10CheckDigit(data, weightEven, weightOdd, false);
109c110,114
< return getMod10CheckDigit(data, 1, weightOdd, true);
---
> return getMod10CheckDigit(data, 1, weightOdd, false);
> }
>
> public static void main(String args[]) throws Exception {
> System.out.println(getMod10CheckDigit(args[0],3));

Discussion


Log in to post a comment.

MongoDB Logo MongoDB