How to convert character encoding from CP932 to UTF-8 in nodejs javascript, using the nodejs-iconv module (or other solution)

后端 未结 3 937
天涯浪人
天涯浪人 2020-12-15 14:07

I\'m attempting to convert a string from CP932 (aka Windows-31J) to utf8 in javascript. Basically I\'m crawling a site that ignores the utf-8 request in the request header

3条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-15 14:32

    I got same trouble today :)
    It depends libiconv. You need libiconv-1.13-ja-1.patch.
    Please check followings.

    • http://d.hatena.ne.jp/ushiboy/20110422/1303481470
    • http://code.xenophy.com/?p=1529

    or you can avoid problem using iconv-jp try

    npm install iconv-jp

提交回复
热议问题