0

My requirement is to generate QR code for below 2 texts in javascript/jQuery

  • Text 1: Hello, I am first plain text
  • Text 2: I am 2nd text with emojis like shopping cart and star

Condition is that I can't use any URL feed to generate QR code online like below Google QR example
https://chart.googleapis.com/chart?cht=qr&chs=200x200&chl=ThisIsSomeText
If I use above, QR code for both texts are generated successfully(checked after scanning)

I only have to use any QR code plugin within my code to generate QR code offline(no network connectivity restriction)
So, I tried below jQuery plugins that would work offline

Plugin 1: https://www.studytonight.com/post/javascript-qr-code-generator
Plugin 2(qrenc3.html): https://code.google.com/archive/p/jsqrencode/downloads

If I use any of above 2 plugins, the QR code is properly generated for Text 1 only, not Text 2.
If text has emojis, it creates improper QR code. Check below generated QR codes.

For Text 1: (Plain text)below is code generated(proper text comes after scanning)
enter image description here

For Text 2: (Emojis)below is code generated(Unknown encoding or not scannable)
enter image description here

I need help if anyone can solve above or share any jQuery plugin (offline) that would generate QR code for emojis.

[I have not added any code as plugins already have demo in them. Hope that's fine]
Thanx in advance for help.

foodiepanda
  • 128
  • 1
  • 14
  • Please provide Minimal, Reproducible Example: https://stackoverflow.com/help/minimal-reproducible-example and the Strings you are testing with. – Twisty Dec 11 '20 at 15:32
  • 1
    Does this answer your question? [Is UTF-8 the encoding of choice for QR-codes with non ASCII chars by now?](https://stackoverflow.com/questions/9699657/is-utf-8-the-encoding-of-choice-for-qr-codes-with-non-ascii-chars-by-now) – Peter O. Dec 11 '20 at 15:36
  • 1
    Most of QR code readers expect ISO-8859-1 encoding ! I know that sounds weird... You could try it yourself : Copy your text here => https://coderstoolbox.net/string/#!encoding=url&action=decode&charset=iso_8859_1 ... then generate it here => https://qreader.online/generate.html . You will get your expected results. You can use Iconv-lite to convert encoding using JS https://github.com/ashtuchkin/iconv-lite – Bilel Dec 11 '20 at 15:43

0 Answers0