title: Why can't I write Chinese characters in nodejs HTTP response?
body: <p>Here is my little code:</p>
  
  <pre><code>var http = require('http');
  var port = 9002;
  var host_ip = '&lt;my_ip&gt;';
  http.createServer(function (req, res) {
      var content = new Buffer("Hello 世界", "utf-8")
      console.log('request arrived');
      res.writeHead(200, {
          'Content-Encoding':'utf-8',
          'charset' : 'utf-8',
          'Content-Length': content.length,
          'Content-Type': 'text/plain'});
      res.end(content.toString('utf-8'),'utf-8');
  }).listen(port, host_ip);
  console.log('server running at http://' + host_ip + ':' + port);
  </code></pre>
  
  <p>Previously I just let <code>res.end</code> to send "hello world" and it worked well. Then I wanted to adjust a little bit and changed the 'world' into the Chinese equivalent '世界', and so changed the 'charset' 'content-type' in the header to 'utf-8'. But in Chrome and Firefox I see this:</p>
  
  <pre><code>hello 涓栫晫
  </code></pre>
  
  <p>However, amazingly opera(11.61) does show the correct result <code>hello 世界</code>. I want to know whether I have missed something in the code, and why this is happening. Thank you guys.</p>
  
  <p>I think <a href="https://stackoverflow.com/questions/9698552/chinese-character-in-nodejs-response-write">this post</a> is similiar with my situation but not exactly.</p>