【经验之谈】Use Buffers when decoding
发布于 7个月前 作者 yaochun 287 次浏览

最近review别人写的代码,发现:

iconv-lite的使用上还是有点小问题:

1、Buffer里面:

‘binary’ - A way of encoding raw binary data into strings by using only the first 8 bits of each character. This encoding method is deprecated and should be avoided in favor of Buffer objects where possible. This encoding will be removed in future versions of Node.

2、关于 iconv.decode的decode

Keep original Buffer-s and provide them to iconv.decode. Use Buffer.concat() if needed.

In general, keep in mind that all javascript strings are already decoded and should not be decoded again.

有兴趣的人在使用iconv-lite的decode的时候注意一下

回到顶部