We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Swiss-QR-Code Encoding Problems


We are using Aspose.BarCode and have problems with the generated qrcodes. When we validate the generated qrcodes with the SIX-QRCode-Validator there are problems with the special characters.
Special_Character_Error.png (84.0 KB)

How can we fix this?

Please try this scenario with the latest version Aspose.BarCode 21.8 and check if still issue is there or not. If you find the issue with the latest version, share your runnable sample code, output image and expected image generated by some third party tool for our reference. We also need the link to the SIX-QRCode-Validator along with the steps to validate, that you are using for the validation.

I’ve now tried the latest version and have still the same problems.

	public void TestQRCode()
		SwissQRCodetext qrCode = new SwissQRCodetext();
		qrCode.Bill.Version = SwissQRBill.QrBillStandardVersion.V2_0;
		qrCode.Bill.Account = "CH4431999123000889012";
		qrCode.Bill.Amount = 1000.25m;
		qrCode.Bill.Currency = "CHF";
		qrCode.Bill.Reference = "210000000003139471430009017";
		qrCode.Bill.Creditor = new Address
			                       Name = "Muster & Söhne",
			                       Street = "Musterstrasse",
			                       HouseNo = "12b",
			                       PostalCode = "8200",
			                       Town = "Zürich",
			                       CountryCode = "CH"

		qrCode.Bill.Debtor = new Address
			                     Name = "Muster AG",
			                     Street = "Musterstrasse",
			                     HouseNo = "1",
			                     PostalCode = "3030",
			                     Town = "Bern",
			                     CountryCode = "CH"

		ComplexBarcodeGenerator generator = new ComplexBarcodeGenerator(qrCode);
		generator.Parameters.Barcode.Padding.Bottom.Millimeters = 0;
		generator.Parameters.Barcode.Padding.Top.Millimeters = 0;
		generator.Parameters.Barcode.Padding.Left.Millimeters = 0;
		generator.Parameters.Barcode.Padding.Right.Millimeters = 0;
		generator.Parameters.ImageWidth.Millimeters = 46;
		generator.Parameters.Barcode.QR.CodeTextEncoding = Encoding.UTF8;
		generator.Parameters.Barcode.QR.QrECIEncoding = ECIEncodings.ISO_8859_1;
		generator.Save(@"C:\tmp\qr.png", BarCodeImageFormat.Png);

qr_generated.png (1.9 KB)
qr_reference.png (20.8 KB)
SIX_Validator.pdf (344.9 KB)

We have logged it in our database for detailed analysis. You will be notified here once any update is ready for sharing.

This issue is logged as:

BARCODENET-37880 - Swiss-QR-Code Encoding Problems

The problem is in these two rows

This could solve the problem.

//remove generator.Parameters.Barcode.QR.CodeTextEncoding = Encoding.UTF8;
generator.Parameters.Barcode.QR.QrEncodeMode = QREncodeMode.ECIEncoding;
generator.Parameters.Barcode.QR.QrECIEncoding = ECIEncodings.UTF8;

Yes, now it works.