metzli
metzli copied to clipboard
Binary encoder fails if over 31 chars
`require 'bootstrap.php';
use Metzli\Encoder\Encoder; use Metzli\Encoder\DataEncoder\BinaryDataEncoder; use Metzli\Renderer\PngRenderer;
$encoder = new BinaryDataEncoder();
$code = Encoder::encode(str_repeat("a", 50), 33, $encoder); $renderer = new PngRenderer();
file_put_contents("test.png", $renderer->render($code)); ` The barcode scanner says there is an extra KF at the end of the string
I had the same issue, the solution implemented in @bozhinov saved my day.
Line 35 in src/Metzli/Encoder/DataEncoder/BinaryDataEncoder.php
should be:
$result->append(($chunkLength - 31), 11);
instead of:
$result->append(($chunkLength - 32), 11);
For me it caused the errorous byte. Complete message was correct except for 1 byte.
Should I create MR for it?