Fixed generating EPC QR Codes with UTF-8 values

This commit is contained in:
dankito 2024-10-04 03:14:18 +02:00
parent a928f04fa6
commit 13d01a6be3
1 changed files with 2 additions and 1 deletions

View File

@ -16,8 +16,9 @@ open class EpcQrCodeGenerator {
open fun generateEpcQrCode(config: EpcQrCodeConfig): EpcQrCode {
val heightAndWidth = config.qrCodeHeightAndWidth
val epcQrCodeContent = generateAsString(config)
val epcQrCodeContentBytes = epcQrCodeContent.encodeToByteArray() // qrCode.msg() contains a bug for UTF-8 characters -> encode manually to bytes
val qrCodeBitmap = qrCode.msg(epcQrCodeContent)
val qrCodeBitmap = qrCode.msg(epcQrCodeContentBytes)
.scaled(heightAndWidth, heightAndWidth, true)
val qrCodeBytes = convertToFormat(qrCodeBitmap, config.imageFormat)