python-barcode icon indicating copy to clipboard operation
python-barcode copied to clipboard

nos expected result with gs1_128

Open ctc87 opened this issue 4 years ago • 12 comments

When create barcode from string :

`
def generate_barcode(self):

    code = u"(01)01234567890128(15)057072"
    GS1 = barcode.get_barcode_class('gs1_128')
    fp = io.BytesIO()
    gs1 = GS1(code, writer=ImageWriter()).write(fp)
    a = base64.b64encode(fp.getbuffer())

` The expected result its: image The result obtanides its: image

ctc87 avatar May 27 '20 12:05 ctc87

I tried a couple of barcode readers (including this one online), and the former barcode doesn't match the input string, but the generated one reads properly.

Can you clarify a bit more what's wrong?

WhyNotHugo avatar May 28 '20 19:05 WhyNotHugo

@WhyNotHugo According to GS1 specs for GS-128, the parentheses enclosing the Application Identifiers (AIs) should be visible in the Human Readable Interpretation (HRI) (the string below the barcode) but should NOT be encoded in the barcode itself.

diggy128 avatar Dec 07 '20 16:12 diggy128

Oh, I'd no idea. Do you have a link to this spec?

I guess the right fix then would be for this lib to add the parenthesis to the generated label, but not to the barcode itself.

WhyNotHugo avatar Dec 07 '20 17:12 WhyNotHugo

GS1 General Specifications For GS1-128 see Pages 272-286

Regarding the parentheses in HRI see page 229: chapter 4.15, rule 3

Keep the specs at hand. It's a great source of information and the fact that it is freely available makes it invaluable.

I'll be around if you need anything else and I can help!

diggy128 avatar Dec 07 '20 22:12 diggy128

Finally y use external string with the barcode to generate the final image. The problem was the parentesis . Thx for aswer.

ctc87 avatar Dec 09 '20 15:12 ctc87

Please reopen. This does not work as it should.

diggy128 avatar Dec 13 '20 13:12 diggy128

Srry.

ctc87 avatar Dec 14 '20 11:12 ctc87

I believe #100 (which has just been merged) should have fixed this.

Can you confirm this works fine?

WhyNotHugo avatar Dec 24 '20 13:12 WhyNotHugo

Unfortunately it doesn't. I skimmed through the code and the PR has to do with EAN13 not GS128 (aka code128) and adding guard bars.

Parentheses are still encoded in the barcode. Am I missing something?

diggy128 avatar Dec 24 '20 13:12 diggy128

My bad, mixed up barcodes 😅

WhyNotHugo avatar Dec 24 '20 17:12 WhyNotHugo

Any news on this one?

diggy128 avatar Jul 16 '21 10:07 diggy128

Hi, if you do :

gs1 = barcode.get_barcode_class('gs1_128')
barcode_img = gs1('90502087191121904229589045190400011980', writer=ImageWriter())

if you compare the image generated with the right image below, you can see they are diferent.

image

You read codebar generated, but in some cases it doesn't work.

jmarxuach avatar Oct 05 '21 13:10 jmarxuach