I cannot display chinese character response to browser using nodejs ?Chinese character in nodejs response write
jsdom.env({ html: 'http://www.baidu.com',
scripts: ['http://code.jquery.com/jquery-1.6.min.js']
}, function (err, window) {
//Use jQuery just as in a regular HTML page
var $ = window.jQuery;
res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
res.end($('title').text());
});
Incorrect result : ٶ һ £ ֪
Correct result should be : 百度一下,你就知道
Are you able to print to console correctly? – 2012-03-14 16:19:12