问答详情
源自:6-7 二维码扩展

VCard中文乱码

老师,我用Jquery qrcode 生成的VCard二维码,读取的中文乱码怎么解决啊

提问者:番茄盐煎肉 2016-07-28 17:01

个回答

  • 慕粉3985578
    2017-03-22 22:30:16

    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;  

        }  


  • 连宏伟HW
    2016-07-29 12:01:13

    你扫的结果是什么?

  • 番茄盐煎肉
    2016-07-29 08:33:18

    http://img.mukewang.com/579aa41a0001dc2508710527.jpg

    文件编码是UTF-8,大神笑纳

  • fengshunsgit
    2016-07-28 21:10:07

    文件编码是什么,有代码源码吗?