picqer / php-barcode-generator

Barcode generator in PHP that is easy to use, non-bloated and framework independent.
GNU Lesser General Public License v3.0
1.66k stars 400 forks source link

Code 32 not creating checksum digit #164

Closed Bernhard-Krop closed 2 years ago

Bernhard-Krop commented 2 years ago

I've tested the new code 32 and it's not working. It's generating a completely wrong content.

According to the italian Wikipedia page of code 32, a code 32 barcode consists out of a start symbol, 9 characters and a stop symbol. The 9 characters are consisting of a leading 0, 7 symbols free to choose and a trailing checksum digit. The leading 0 seems only important to the italian pharma industry, because I've found other code 32 examples not having a leading zero and they can be scanned without problems. Assuming that, the 9 characters are consisting of 8 symbols free to choose and a trailing checksum digit. I could not find any code 32 barcode having another length. So the code, consisting of 9 characters seems to be important.

According to the paragraph above, the code 32 implementation has 2 failures:

I've tried to create code 32 barcodes providing the checksum digit as part of the input string. That worked very well using only numbers.

Furthermore, according to the italian Wikipedia page of code 32, code 32 can encode 32 characters: numbers (0-9) and upper case letters (A-Z) excluding the letters "A", "E", "I" and "O".

The implementation is only working with integers; not with upper case letters. Using upper case letters lets the barcode generation either fail or outputting warnings and generating a barcode containing wrong information.

I'll start working on a pull request to fix the problems.

Bernhard-Krop commented 2 years ago

@casperbakker I've provided a pull request to fix the above problems.

I have to admit, that the issue with uppercase letters does not exist. This was a misunderstanding of mine. Code 32 supports only digits, which are mapped to the above characters in code 39.