NodeJS: Request ISO-8859-1 encoded content

Viewed 4517

I just want store in Mongo (so in UTF8) the content of a RSS feed. But I cannot even download content properly encoded :

var request = require('request');
var iconv = require('iconv');

var feedTest = function(url) {

request(url, {timeout: 20000}, function(error, resp, body) {
    if (error) {
        console.log(url + " : " + error);
    }
    else
    {
        var ic = new iconv.Iconv('iso-8859-1', 'utf-8');
        var buf = ic.convert(body);
        var buffer = buf.toString('utf-8');
        console.log(resp.statusCode);
        console.log(buffer);
    }
});
};

feedTest("http://feeds.feedburner.com/spin-off-actu");

The accent are not in clear. No problem in PHP with iconv, but with this NodeJS code what is wrong?

1 Answers
Related