I'm making the following request:
var request = require('request');
var cheerio = require('cheerio');
request(url, function(error, response, html) {
if (!error) {
var $ = cheerio.load(html);
console.log(html);
}
And I am only getting jewel characters. How can I get the correct output?
Solution:
I followed the suggestion on this answer.
app.get('/fetchdata', function(req, res) {
request({
uri: urlSource,
//null for encoding to avoid default utf-8
encoding: null
}, function(error, response, html) {
//using iconv to decode to iso-8859 /latin1
html = iconv.decode(html, 'iso-8859-1');
console.log(html);
...