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.67k stars 402 forks source link

Character issue in v2.4.0 #166

Closed erangalp closed 2 years ago

erangalp commented 2 years ago

After updating from v2.2.0 to v.2.4.0, when we try to encode a string such as "id857485" to a barcode, we get the following exception thrown - "Char i is unsupported" Trace -

0 /var/www/maonrails/html/library/vendor/picqer/php-barcode-generator/src/BarcodeGenerator.php(103): Picqer\Barcode\Types\TypeCode39->getBarcodeData()

1 /var/www/maonrails/html/library/vendor/picqer/php-barcode-generator/src/BarcodeGeneratorSVG.php(20): Picqer\Barcode\BarcodeGenerator->getBarcodeData()

Downgrading back to v2.2.0 resolves this. Would appreciate it if you could take a look and see if you can make it work on the latest version as well

Bernhard-Krop commented 2 years ago

Hi @erangalp,

barcode type Code39 supports only uppercase letters. Throwing an exception after an unsupported character occurred is the right way.

To fix your problem, you have to either provide a string with only uppercase letters, or use Code39Extended, which supports lowercase letters.

Kind regards,

Bernhard Krop

erangalp commented 2 years ago

Understood, thanks for the explanation!