[reportlab-users] Code 11 barcode bug

Sergiu Iordache solidsnakero at gmail.com
Mon Mar 1 14:40:28 EST 2010


On Mon, Mar 1, 2010 at 1:30 PM, Robin Becker <robin at reportlab.com> wrote:

> On 28/02/2010 22:18, Sergiu Iordache wrote:

>>

>> Hello,

>>

>> After trying to use the Code 11 barcode drawing function I am pretty

>> sure that it is bugged. It doesn't seem to generate the correct

>> barcode, but I haven't found the bug origin or solution yet. If I do,

>> I'll post the solution here.

>>

>> Here[1] is the example code to generate a Code 11 barcode for the

>> number 1 . It generates this barcode[2].

>> The result is not correct, as the last character does not correspond

>> to the first one and does not have enough characters. Here is the same

>> number generated using an online generator [3]

>>

>> If anyone figures out the solution please post it here. The bug is

>> most probably located here[4].

>>

>> Thanks a lot,

>> Sergiu

>

> ........

>

> OK I think I found two problems here.

>

> First off my googling reveals this

>

> http://www.mecsw.com/specs/code_11.html

>

> that seems to indicate that both checksums should be mod 11 and not as in

> the current code mod 11 & mod 10. Secondly I checked and the decompose step

> was wrongly calculating the intermediate characters.

>

>

> I think the attached is an improvement. Can you test it and report if it's

> better for you? I don't have a reader which works with code11 so it would be

> valuable if you can check if the second check digit is being correctly

> computed.


Hey Robin, thanks a lot for the quick fix.

Although the online generators don't seem to be consistent(not all
offer options for the error checking codes), I've written my own
decoder based on the Code 11 specification(read from two sources) and
now it successfully parses codes generated by ReportLab. The check
codes correspond as well.

I have tested it using multiple input with both less and more than 10
characters. That makes me believe that the version you provided is
correct.

Thanks again for the fix,
Sergiu


More information about the reportlab-users mailing list