Type of issue
[x ] Bug
[ ] Question (e.g. about handling/usage)
[ ] Request for new feature/improvement
Expected Behavior
I'm trying to generate a version 8 QR Code to share an URL, and I thought it would simply generate it with the specified parameters
Current Behavior
However, it throws the following exception:
QRCoder.Exceptions.DataTooLongException: 'The given payload exceeds the maximum size of the QR code standard. The maximum size allowed for the chosen parameters (ECC level=M, EncodingMode=Byte, FixedVersion=8) is 152 bytes.'
Possible Solution (optional)
I noticed that the encoding mode selected for the text is Byte even though the text is Alphanumeric. I took a look at the code and found out that this is the method used to assign the EncodingMode, and the highlighted . According to qrcode.com, the maximum byte size for a version 8 QR Code with an alphanumeric encoding and an ECC-level M is 221, which would fit my URL, an alphanumeric text.

Steps to Reproduce (for bugs)



QRCodeGenerator qrGenerator = new QRCodeGenerator();
QRCodeData qrCodeData = qrGenerator.CreateQrCode(new PayloadGenerator.Url("https://www.walmart.com/search?q=oatmeal&max_price=7&catId=976759&facet=flavor%3AUnflavored%7C%7Ccustomer_rating%3A4+-+5+Stars%7C%7Ccontainer_type%3ABag%7C%7Cdietary_need%3AOrganic%7C%7Cretailer_type%3AWalmart")
.ToString(), QRCodeGenerator.ECCLevel.M, requestedVersion: 8);
AsciiQRCode qrCode = new AsciiQRCode(qrCodeData);
string qrCodeAsAsciiArt = qrCode.GetGraphicSmall(drawQuietZones: false);
Your Environment
Type of issue
[x ] Bug
[ ] Question (e.g. about handling/usage)
[ ] Request for new feature/improvement
Expected Behavior
I'm trying to generate a version 8 QR Code to share an URL, and I thought it would simply generate it with the specified parameters
Current Behavior
However, it throws the following exception:
QRCoder.Exceptions.DataTooLongException: 'The given payload exceeds the maximum size of the QR code standard. The maximum size allowed for the chosen parameters (ECC level=M, EncodingMode=Byte, FixedVersion=8) is 152 bytes.'
Possible Solution (optional)
I noticed that the encoding mode selected for the text is Byte even though the text is Alphanumeric. I took a look at the code and found out that this is the method used to assign the EncodingMode, and the highlighted . According to qrcode.com, the maximum byte size for a version 8 QR Code with an alphanumeric encoding and an ECC-level M is 221, which would fit my URL, an alphanumeric text.

Steps to Reproduce (for bugs)
Your Environment