随笔test

发个随笔test

  1. 标题一
     1 function Utf8Encode(string){
     2             string = string.replace(/\r\n/g, "\n");
     3             var utftext = "";
     4             for (var n = 0; n < string.length; n++) {
     5                 var c = string.charCodeAt(n);
     6                 if (c < 128) {
     7                     utftext += String.fromCharCode(c);
     8                 }
     9                 else if ((c > 127) && (c < 2048)) {
    10                     utftext += String.fromCharCode((c >> 6) | 192);
    11                     utftext += String.fromCharCode((c & 63) | 128);
    12                 }
    13                 else {
    14                     utftext += String.fromCharCode((c >> 12) | 224);
    15                     utftext += String.fromCharCode(((c >> 6) & 63) | 128);
    16                     utftext += String.fromCharCode((c & 63) | 128);
    17                 }
    18             }
    19             return utftext;
    20         }
    function Utf8Encode(string){
                string = string.replace(/\r\n/g, "\n");
                var utftext = "";
                for (var n = 0; n < string.length; n++) {
                    var c = string.charCodeAt(n);
                    if (c < 128) {
                        utftext += String.fromCharCode(c);
                    }
                    else if ((c > 127) && (c < 2048)) {
                        utftext += String.fromCharCode((c >> 6) | 192);
                        utftext += String.fromCharCode((c & 63) | 128);
                    }
                    else {
                        utftext += String.fromCharCode((c >> 12) | 224);
                        utftext += String.fromCharCode(((c >> 6) & 63) | 128);
                        utftext += String.fromCharCode((c & 63) | 128);
                    }
                }
                return utftext;
            }
    View Code
    引用test  
  2. 标题二
posted @ 2017-07-03 16:30  风吟露气  阅读(77)  评论(0编辑  收藏  举报