I am trying to get the correct encoding with request.
request.get({
"uri":'http://www.bold.dk/tv/',
"encoding": "text/html;charset='charset=utf-8'"
},
function(err, resp, body){
console.log(body);
}
);
No matter what I do the encoding of the danish chars are not right.
Any thoughts?
You can use iconv (lite) to convert this. You also need to tell request not to actively set the encoding to the default of UTF-8 by setting the encoding property to null. Therefore you should do:
Maybe your trouble is in
'Accept-Encoding'
header. Let's say you have Headers like'Accept-Encoding': 'gzip,deflate'
If it's so, you have 2 ways to fixing this:
Use the following code to unzip the data: