jquery-qrcode
jquery-qrcode copied to clipboard
Bugs!!
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:
But when I remove op.render = "table";
, the generated qrcode can be decoded.
This bug shown in my page too.
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