Answer the question
In order to leave comments, you need to log in
Why are there bugs in the node-request response?
Good afternoon. Interested in such a problem, why request in binary mode returns krakozyabry from utf-8 pages?
Example:
var request = require('request');
request({
uri: 'http://www.cn.ru/',
method: 'GET',
encoding: 'binary' // режим получения кракозябр вместо ответа
}).on('response', function(res) {
res.on('data', function(data) {
// получаем кучу кракозябр
console.log(data.toString());
});
});
Answer the question
In order to leave comments, you need to log in
Because binary is still a binary data format. It will always return krakozyabry.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question