how-to convert encoding with node.js feedparser for rss-feeds

1.2k views Asked by At

How to parse this feed http://www.taraf.com.tr/rss/yazarlar/default.asp and show it as is on my website?

I parse with feed-parser https://github.com/danmactough/node-feedparser, store in mongodb and show on website. result is gibberish.

I don't even know the cause of problem, do i need to change encoding with iconv? or problem is something else.

i tried this solution here but it doesn't work. https://github.com/danmactough/node-feedparser/pull/99/files

One possible code i use:

    var Q = require('q');
    var FeedParser = require('feedparser');
    var es = require('event-stream');
    var request = require('request');

    var ReadRss = function () {
    var deferred = Q.defer();
    var result = [];

    request('http://www.radikal.com.tr/d/rss/RssYazarlar.xml')
    .pipe(es.through(function(data) {
        // conversion might be here with icon-v
        this.emit('data', data);
    }))

          .pipe(new FeedParser())

    .on('readable', function() {
        var stream = this, item;

        while (item = stream.read()) {
            result.push(item);
        }

    })
        .on('end', function () {
            deferred.resolve(result);
        });
      return deferred.promise;

    } // end of function ReadRSS

    // some usage
     ReadRss().then(function (result) {
      //  console is untrustable either it shows gibberish       
      console.log(result);
   });
0

There are 0 answers