|
发表于 2016-12-5 10:36:09
|
显示全部楼层
在你的代码中加入这些- // 识别中文内容的二维码
- var str = options.text;
- var codeUrl, i, len, c;
- codeUrl = "";
- len = str.length;
- for (i = 0; i < len; i++) {
- c = str.charCodeAt(i);
- if ((c >= 0x0001) && (c <= 0x007F)) {
- codeUrl += str.charAt(i);
- } else if (c > 0x07FF) {
- codeUrl += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));
- codeUrl += String.fromCharCode(0x80 | ((c >> 6) & 0x3F));
- codeUrl += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
- } else {
- codeUrl += String.fromCharCode(0xC0 | ((c >> 6) & 0x1F));
- codeUrl += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
- }
- }
- // *************************************************************************
复制代码 |
|