Skip to content
New issue

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

correct support of unicode texts #266 #236 #279

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

se-ti
Copy link

@se-ti se-ti commented Oct 6, 2022

One can easily test, that library draws wrong QR-codes for some special inputs like
new QRCode(elem "\x80");
new QRCode(elem, "\u0800"); // samaritan letter alaf
or any string, conatining chars with codes greater than 0xFFFF
new QRCode(elem, "🔥");

The reasons are

  • minor bounds check mistakes
  • string method charCodeAt never returns codes greater than 0xFFFF, so one of the branches of QR8bitByte is never used!

One should notice, that js support for unicode strings is pretty poor:
"🔥".length === 2, even though every human would say, this string has one 'character'.

P.S. qrcode.min.js should be updated also, i suppose, but i'm not sure which settings should be used, except smth like "preserve ie 6 compatibility"

@se-ti
Copy link
Author

se-ti commented Oct 9, 2022

@davidshimjs, could you please merge it, or reject, or smth else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant