十六进制转字符串

安装

npm install iconv-lite --save

main.js

var iconv = require('iconv-lite');
app.config.globalProperties.iconv = iconv
 hexToString('b2d9d7f7b3c9b9a60000000000')
  function hexToString(h) {
            // let gbk_buf = proxy.iconv.encode(t, 'gbk');  //gbk编码
            // console.log(gbk_buf, 'gbk_buf++++++')
            let gbk_buf = Buffer.from(h, 'hex');  //gbk编码
            console.log(gbk_buf, 'gbk_buf++++++')
            let gbk_str = proxy.iconv.decode(gbk_buf, 'gbk'); //gbk解码
            console.log(gbk_str, 'gbk_str++++++')

        }

十六进制转字符串

 

上一篇:nodejs利用http和request模块(用于爬虫)


下一篇:编码转换 mb_convert_encoding 和 iconv 的区别