jquery-qrcode icon indicating copy to clipboard operation
jquery-qrcode copied to clipboard

Bugs!!

Open zj3782 opened this issue 9 years ago • 2 comments

When I use below codes to generate the qrcode, the generated qrcode can not be decoded.

function utf16to8(str) {
    var out, i, len, c;
    out = "";
    len = str.length;
    for (i = 0; i < len; i++) {
        c = str.charCodeAt(i);
        if ((c >= 0x0001) && (c <= 0x007F)) {
            out += str.charAt(i);
        } else if (c > 0x07FF) {
            out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));
            out += String.fromCharCode(0x80 | ((c >> 6) & 0x3F));
            out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
        } else {
            out += String.fromCharCode(0xC0 | ((c >> 6) & 0x1F));
            out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
        }
    }
    return out;
}

var text = "http://jiceshi.heimalanshi.com/test?id=9";
var op={};
op.width=200;
op.height=200;
op.text=utf16to8(text);
op.render = "table";
jQuery('#qrcode').qrcode(op);

The generated qrcode is shown as below: table

But when I remove op.render = "table";, the generated qrcode can be decoded. canve

zj3782 avatar Jul 08 '15 13:07 zj3782

This bug shown in my page too.

fangge avatar Dec 30 '15 09:12 fangge

hello,I also meet this problem. my url is "http://10.181.65.222:9504/content/guizhou/news/infodetail.544287728101533.html". default type "canvas" to render is right. I look at the source code lot of time ,debuging many times ,could not find the real reason. help help

woden0415 avatar Apr 20 '17 06:04 woden0415