发个随笔test
- 标题一
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; }
引用test
- 标题二