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

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -