Answer the question
In order to leave comments, you need to log in
How to specify encoding in request module in node.js?
All Cyrillic characters sent using the 'request' and 'http' modules end up as an incomprehensible cluster of Latin numbers and letters.
I send it to api.vk, and the following comes up:
What exactly are the actions required to return the Slavic power to the script ?!
Answer the question
In order to leave comments, you need to log in
func1() {
return this.setJson();
}
async func2() {
let q = await this.func1();
return q;
}
I will offer a more modern version of vk-io .
In your version, you get a chunk, not a full string:
.on('response', (response) => {
let body = '';
response.on('data', (chunk) => {
body += String(chunk);
});
response.on('end', () => {
body = JSON.parse(body);
console.log(body);
});
})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question