生成html网页,然后直接进行utf-8编码
var http = require('http'); var dt = require('./DateModule') http.createServer(function(req, res){ res.writeHeader(200, {'Content-Type' : 'text/html;charset:utf-8' }); res.write('<head><meta charset="utf-8"/></head>'); res.write("The date and time are currently: " + dt.myDateTime()); res.end('Hello world! 你好'); }).listen(8080);