post gbk
function gbkEncodeURIComponent(str){
var chinese = new RegExp(/[^\x00-\xff]/g);
var gbkBuffer = null;
var i = 0;
var tempStr = '';
if (chinese.test(str)){//
gbkBuffer = iconv.encode(str,'gbk');
for (i;i<gbkbuffer.length;i++){ tempstr="" +="%" gbkbuffer[i].tostring(16);="" };="" return="" tempstr;="" }else{="" str;="" qs.escape(str);="" }="" const="" postdata="qs.stringify(data,null," null,="" {="" encodeuricomponent:="" gbkencodeuricomponent="" })="" axios.post(url,="" postdata,{responsetype:="" "arraybuffer",})="" .then(res=""> {
let str = iconv.decode(res.data, 'gbk');
console.log("receive-----------"+str.toString())
}).catch(err => console.log(err))</gbkbuffer.length;i++){>
本文出自 码农,转载时请注明出处及相应链接。
发表评论