Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

128 barcode are not accurate #24

Open
liviupopovici123 opened this issue Sep 28, 2021 · 3 comments
Open

128 barcode are not accurate #24

liviupopovici123 opened this issue Sep 28, 2021 · 3 comments

Comments

@liviupopovici123
Copy link

liviupopovici123 commented Sep 28, 2021

Hi,
I've tried to encode "10500400412728169" using 128 and 128C. They are the same. I've tried to decode using an online tool and it decodes as "010500400412728169".
This is the generated barcode
image
And this is the correct one that should be generated
image001
Any thoughts on this?

@Tagliatti
Copy link
Owner

Thanks for reporting, I'm investigating the issue.

@Vandersteen
Copy link

Vandersteen commented Nov 28, 2021

It appears to be happening when having an 'uneven' number of numbers:

Generates a correct barcode:

  • 1234
  • 123456
  • 12345678

Generates a barcode prefixed with 0:

  • 123
  • 12345
  • 1234567

Which appears to be coming from:

//CODE C: adds a 0 to the front of the Data if the length is not divisible by 2

I don't have knowledge of the CODE128 barcode structure so this might be correct behaviour

@trajekolus
Copy link

@Vandersteen I think it is correct behavior because Code128 automatically switch between the three subsets (A, B, and C) to code the data in the shortest form.
And if subset C is picked, a leading "0" is added if there are an odd number of digits in the code as you also found.

Specifying Code128B specifically solved the issue for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants