I'm using the nodejs request module to get some HTML of a website.
There are special characters in the HTML code of the website, which can't be parsed by node request.
For example: ä ü
or ö
will be parsed to �
So if theres a username like Ämilia
its �milia
My basically looks like this:
const request = require("request");
let link = hidden_link;
const requestPromise = util.promisify(request);
const response = await requestPromise(link);
console.log(response.body) // unparsed special chars here
Is there an easy node.js way to parse special characters?
The solution was to use an encoding parameter:
const request = require("request");
let link = hidden_link;
const requestPromise = util.promisify(request);
const response = await requestPromise({ encoding: "latin1", url: link });
console.log(respone.body);