出现问题
第一种配置无法解决,不是中文乱码问题,纯英文也是乱码,则采用第二种配置才能解决!!
源码:
var http=require('http');
http.createServer(function (request, response) {
// 发送 HTTP 头部
// HTTP 状态值: 200 : OK
// 内容类型: text/plain
response.writeHead(200, {'Content‐Type': 'text/plain'});
response.write('<head><meta charset="utf-8"/></head>');
// 发送响应数据 "Hello World"
response.end('Hello node.js 世界\n');
}).listen(3389);
// 终端打印如下信息
console.log('Server running at http://120.77.37.102:3389/');
完美解决!!!