是否可以讀取非UTF8編碼的網頁?例如windows-1251。 我嘗試使用節點的iconv轉換結果:nodejs http響應編碼
var convertedBody = new Iconv('windows-1251','utf-8').convert(responseBody));
,但我得到異常:
Error: EILSEQ, Illegal character sequence.
at IncomingMessage.<anonymous> (/root/nodejstest/test2.js:22:19)
at IncomingMessage.emit (events.js:59:20)
at HTTPParser.onMessageComplete (http.js:111:23)
at Socket.ondata (http.js:1183:22)
at Socket._onReadable (net.js:654:27)
at IOWatcher.onReadable [as callback] (net.js:156:10)
謝謝!
您是否已經對谷歌的NodeJS組檢查出[此線程(http://groups.google.com/group/nodejs/browse_thread/thread/b2603afa31aada9c)?似乎針對您的問題... – schaermu 2011-02-28 12:45:01
謝謝,我會檢查。 – chardex 2011-02-28 16:53:57