codebude / QRCoder

A pure C# Open Source QR Code implementation
MIT License
4.59k stars 1.09k forks source link

32 length string is not recognizable #254

Closed elisy closed 3 years ago

elisy commented 4 years ago

QRCoder 1.3.9, .Net core 3.1

Type of issue

[X] Bug
[ ] Question (e.g. about handling/usage)
[ ] Request for new feature/improvement

Expected Behavior

When I generate QR-code for 32 length string I want to recognize QR-code.

Current Behavior

Generated QR-code is not recognizable by QR Droid. If you change string with the same length the qrcode will be nonrecognizable too.

Steps to Reproduce (for bugs)

QRCodeGenerator qrGenerator = new QRCodeGenerator();
QRCodeData qrCodeData = qrGenerator.CreateQrCode("https://www.gallery.kz/p/20309pi", QRCodeGenerator.ECCLevel.Q, true, false, QRCodeGenerator.EciMode.Utf8);
QRCode qrCode = new QRCode(qrCodeData);
using (Bitmap image = qrCode.GetGraphic(pixelsPerModule, Color.Black, Color.White, true))

Generated QR-code qrcore-error is not recognized

Your Environment

codebude commented 3 years ago

Hi @elisy ,

I could re-produce the error. It happened if someone used ECI-mode and entered a payload which maxed out a specific QR code version. Unfortunately the additional headers for ECI mode weren't taken into size calculation.

The error was fixed in: https://github.com/codebude/QRCoder/commit/012dee3edb5be2508f35ebc6a3d1d9311dc2c256 And thus will be publicly available with the next Nuget package update.