http://blog.mn886.net/chenjianhua/show/6b02fa4173ed/index.html
ArrayBuffer和String 互相转换
1 function str2ab(str){ 2 var buf = new ArrayBuffer(str.length*2); 3 bufView = new Uint16Array(buf); 4 for(var i=0; i<str.length; i++){ 5 bufView[i] = str.charCodeAt(i); 6 } 7 return buf; 8 } 9 function ab2str(buf){ 10 return String.fromCharCode.apply(null, new Uint16Array(buf)); 11 }