nodejs http.get乱码问题处理方法

var req = http.get(url,function(res){
    res.setEncoding('utf-8');
    var html = ''
    res.on('data',function(data){
        html+=data.toString();
    }).on('end',function(){
        console.log(html);
    })
});
posted @ 2013-12-24 20:46  HughTan  阅读(2292)  评论(0编辑  收藏  举报