Code Length OverFlow Error
When a string is passed in between 192 and 220 characters long and using correct level H a code Length Overflow appears. This looks like it is caused by the wrong number of RSblocks being allocated. It looks like it is only allocating 132 blocks for Type 15 and CorrectLevel H. This appears to be coming from the value in the RS_BLOCK_TABLE [11,36,12] that is called in getRSBlocks.
Ran into this as well with a string 225 characters long.
it is happening for UTF length b/w 195 and 220 in my case..
Same problem here. Switching to another QRCode library. It seems this is no more maintened, and no issue were solved in the past year.
Which QRCode Library do you switched to?
Currently trying this : https://neocotic.com/qrious/ Downloaded production version (minified JS). Will be able to test in few minutes :)
Canvas is a bit small; but hey, it works where this JS script says overflow whatever. :3
For QRious to work, in your HTML body, put :
<canvas id="qrcode"></canvas>
And put this in the generate QR code function:
var divQRCode = document.getElementById("qrcode"); const qr = new QRious({ element: divQRCode, value: "https://keeex.me", size: 500, });
It's nice and works when we have this error on davidshimjs/qrcodejs library.
https://neocotic.com/qrious/
Got a problem with QRious : the GNU GPL v3 license.
So, stuck with this lib.
If you're in my situation, i found a workaround. We're doing JSON object QRCodes and trailing spaces before the last } for data to have a longer length, and this is our generation code :
var json = JSON.stringify(obj);
if(json.length < 218 && json.length > 191) {
json = json.substring(0, json.length-1);
var workaround = " "; // 27 spaces
workaround = workaround.substring(0, 218-json.length);
json += workaround;
json += "}";
}
var divQRCode = document.getElementById("qrcode");
var qrcode = new QRCode(divQRCode, { width : 200, height : 200});
qrcode.makeCode(json);
@ToemD As the author is not doing any pull request/answers here, we fixed this bug on our repository. Clone/download and go. :) https://github.com/KeeeX/qrcodejs
@fladna9 thank you!
@fladna9 thank you,it's helpful
@fladna9 Nearly a year later this saved me. Much appreciated.
@fladna9 thank you very much
@ToemD As the author is not doing any pull request/answers here, we fixed this bug on our repository. Clone/download and go. :) https://github.com/KeeeX/qrcodejs
thanks, it solved the problem
@itboos
Thank you so much, guys!
@fladna9 really thank you
Hello @fladna9 .
I just ran into the same error and your fix worked for me. I tried to understand what was causing the issue but I wasn't able to grasp the root cause. Could you please give me a brief explanation of the root cause?
Thanks in advance ~
Another workaround may be to decrease correctLevel, e.g.: correctLevel: QRCode.CorrectLevel.L
Another workaround may be to decrease correctLevel, e.g.:
correctLevel: QRCode.CorrectLevel.L
it works well for me! thx!
Another workaround may be to decrease correctLevel, e.g.:
correctLevel: QRCode.CorrectLevel.L
THX!
@fladna9, awesome fix!
The only thing I needed to change was to import your script in my HTML file:
<script type="text/javascript" src="https://cdn.rawgit.com/KeeeX/qrcodejs/master/qrcode.min.js"></script>
@ToemD As the author is not doing any pull request/answers here, we fixed this bug on our repository. Clone/download and go. :) https://github.com/KeeeX/qrcodejs
Thank a lot :-)
@ToemD As the author is not doing any pull request/answers here, we fixed this bug on our repository. Clone/download and go. :) https://github.com/KeeeX/qrcodejs
Thanks so much 🙂
Another workaround may be to decrease correctLevel, e.g.:
correctLevel: QRCode.CorrectLevel.L
It solved the problem for me as well. Thank you!
@ToemD As the author is not doing any pull request/answers here, we fixed this bug on our repository. Clone/download and go. :) https://github.com/KeeeX/qrcodejs
Thanks! Saved my bacon!
@fladna9 in heaven there's a place for you :D