From 13d01a6be3123fa5d4800958b73e82782e9357eb Mon Sep 17 00:00:00 2001 From: dankito Date: Fri, 4 Oct 2024 03:14:18 +0200 Subject: [PATCH] Fixed generating EPC QR Codes with UTF-8 values --- .../kotlin/net/codinux/banking/epcqrcode/EpcQrCodeGenerator.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/EpcQrCode/src/commonMain/kotlin/net/codinux/banking/epcqrcode/EpcQrCodeGenerator.kt b/EpcQrCode/src/commonMain/kotlin/net/codinux/banking/epcqrcode/EpcQrCodeGenerator.kt index a98d45d..e291c99 100644 --- a/EpcQrCode/src/commonMain/kotlin/net/codinux/banking/epcqrcode/EpcQrCodeGenerator.kt +++ b/EpcQrCode/src/commonMain/kotlin/net/codinux/banking/epcqrcode/EpcQrCodeGenerator.kt @@ -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)