Configurable encoding. #126

This commit is contained in:
Michael Teeuw
2016-04-05 13:16:23 +02:00
parent 1a20bd2f4d
commit 06efd01032
5 changed files with 24 additions and 8 deletions

View File

@@ -43,10 +43,10 @@ var NewsFetcher = function() {
* attribute success function(items) - Callback on succes.
* attribute error function(error) - Callback on error.
*/
self.fetchNews = function(url, success, error) {
self.fetchNews = function(url, success, error, encoding) {
self.successCallback = success;
self.errorCallback = error;
request({uri:url, encoding:null}).pipe(iconv.decodeStream('ISO-8859-1')).pipe(parser);
request({uri:url, encoding:null}).pipe(iconv.decodeStream(encoding)).pipe(parser);
};
};