Skip to content
Browse files

Content-Length doesn't count characters, but bytes

  • Loading branch information...
1 parent 304c0a5 commit fe4824ee441a5f6b78ec992cd47401c9f13cf07b @svick svick committed Aug 6, 2010
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/node-router.js
View
4 lib/node-router.js
@@ -179,9 +179,9 @@ exports.getServer = function getServer(logger) {
function simpleResponse(code, body, content_type, extra_headers) {
res.writeHead(code, (extra_headers || []).concat(
[ ["Content-Type", content_type],
- ["Content-Length", body.length]
+ ["Content-Length", Buffer.byteLength(body, 'utf8')]
]));
- res.write(body);
+ res.write(body, 'utf8');
res.end();
}

0 comments on commit fe4824e

Please sign in to comment.
Something went wrong with that request. Please try again.