I'm looking to embed non-text raw binary data into a QR, but I can't see any way to do that. I see that data is always passed through:
$bytes = @iconv('utf-8', $encoding, $content);
but here I don't want to do any charset-related conversion, and iconv dies complaining that it can't encode the content:
Fatal error: Uncaught BaconQrCode\Exception\WriterException: Could not encode content to in vendor/bacon/bacon-qr-code/src/Encoder/Encoder.php on line 598
As a simple example, I might want to encode a raw timestamp as 4 bytes, rather than the 10 a string representation would incur:
use Endroid\QrCode\QrCode;
$qrCode = new QrCode(pack('L', time()));
header('Content-Type: '.$qrCode->getContentType());
echo $qrCode->writeString();
I assume that there should be some value to pass in as the encoding to setEncoding, however, I can't find any indication of what values are supported. I've seen both ISO-8859-1 and UTF-8 used, but that's all - and they sound like charsets rather than encodings. Is there a 'raw binary' encoding or something?
I'm looking to embed non-text raw binary data into a QR, but I can't see any way to do that. I see that data is always passed through:
but here I don't want to do any charset-related conversion, and iconv dies complaining that it can't encode the content:
As a simple example, I might want to encode a raw timestamp as 4 bytes, rather than the 10 a string representation would incur:
I assume that there should be some value to pass in as the encoding to
setEncoding
, however, I can't find any indication of what values are supported. I've seen bothISO-8859-1
andUTF-8
used, but that's all - and they sound like charsets rather than encodings. Is there a 'raw binary' encoding or something?