We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
var qrcode = new QRCode(document.getElementById("qrcode"), { text: "01234567890abcd", correctLevel : QRCode.CorrectLevel.L }); console.log(qrcode._oQRCode.getModuleCount());
Should log 21 but this logs 25. The reason is _getUTF8Length is comparing a length to a string and almost always ends up adding 3 (*):
function _getUTF8Length(sText) { var replacedText = encodeURI(sText).toString().replace(/\%[0-9a-fA-F]{2}/g, 'a'); return replacedText.length; }
I'm not 100% sure, but I think the following fix is correct:
507c507 < return replacedText.length + (replacedText.length != sText ? 3 : 0); --- > return replacedText.length;
Happy to send a PR if there's agreement on this fix. Otherwise, I'll let people more familiar with this computation decide what's the correct fix.
* It doesn't add 3 if replacedText equals "", "1", "02", etc. which are degenerate cases.
replacedText
""
"1"
"02"
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Should log 21 but this logs 25. The reason is _getUTF8Length is comparing a length to a string and almost always ends up adding 3 (*):
I'm not 100% sure, but I think the following fix is correct:
Happy to send a PR if there's agreement on this fix. Otherwise, I'll let people more familiar with this computation decide what's the correct fix.
* It doesn't add 3 if
replacedText
equals""
,"1"
,"02"
, etc. which are degenerate cases.The text was updated successfully, but these errors were encountered: