其他分享
首页 > 其他分享> > 十六进制转字符串

十六进制转字符串

作者:互联网

安装

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++++++')

        }

 

标签:十六进制,iconv,console,log,gbk,str,字符串,buf
来源: https://www.cnblogs.com/nwj-mm/p/15420749.html