module.exports = function(req, res, obj, opts) {
  opts = opts || {};

  if (opts.pretty) opts.space = '    ';

  var json = JSON.stringify(obj, null, opts.space || '');
  var buf = new Buffer(json);

  res.setHeader('Content-Type', 'application/json');
  res.setHeader('Content-Length', Buffer.byteLength(json));
  res.end(json);
};

module.exports = function(req, res, obj, opts) {
  opts = opts || {};

  if (opts.pretty) opts.space = '    ';

  var json = JSON.stringify(obj, null, opts.space || '');

  res.setHeader('Content-Type', 'application/json; charset=utf-8');
  res.setHeader('Content-Length', Buffer.byteLength(json));
  res.end(json);
};

remove unsued buffer and added utf-8 support