I have been working on a QR code project recently, so I found this when I was casually looking at it. It feels good. In addition to its own excellent js functions, jquery also comes with countless plug-ins, which can achieve various beautiful effects and functions. jquery.qrcode is one of them, used to generate QR codes online.
The open source address of the qrcode plug-in on github is https://github.com/jeromeetienne/jquery-qrcode
It comes with instructions for use at the back, only four simple steps, very convenient to call.
The plug-in is written by foreigners, so it cannot recognize the QR code of Chinese content when it is first used, because jquery.qrcode itself uses the charCodeAt() method for encoding conversion. This method will obtain its Unicode encoding by default. If there is Chinese content, the string must be converted to UTF-8 before generating the QR code, and then the QR code will be generated. You can add the following function to the page to convert Chinese strings: