Node.js request to xml document not receiving properly encoded format? -


i not entirely sure why, receiving data looks n�f����s� call rss feed formatted in xml.

    exports.search = function(req, res) {         request.get('https://secret.co/usearch/'+req.params.id+'/?rss=1', function (error, response, body) {           console.log(body);           if (!error && response.statuscode == 200) {             parsestring(body, function (err, result) {               res.json(result);             });           }         });     }; 

just on particular url, wondering how can solve , proper xml?

the url in question delivers content gzip encoded. adding option gzip : true request call fix problem:

exports.search = function(req, res) {     request({ method : 'get', url: 'https://kat.cr/usearch/scarface/?rss=1', gzip: true }, function(error, response, body) {       console.log(body);       if (!error && response.statuscode == 200) {         parsestring(body, function (err, result) {           res.json(result);         });       }     }); }; 

Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -