net: account encoding in .byteLength
authorFedor Indutny <fedor.indutny@gmail.com>
Mon, 8 Apr 2013 07:48:46 +0000 (11:48 +0400)
committerFedor Indutny <fedor.indutny@gmail.com>
Mon, 8 Apr 2013 07:48:46 +0000 (11:48 +0400)
lib/net.js

index 4b2622be0db794145355f655a7c6a173c734fb1a..3c58de2837b6a7669e533530710044a7a50da990 100644 (file)
@@ -667,7 +667,7 @@ Socket.prototype.__defineGetter__('bytesWritten', function() {
       encoding = this._pendingEncoding;
 
   state.buffer.forEach(function(el) {
-    bytes += Buffer.byteLength(el.chunk);
+    bytes += Buffer.byteLength(el.chunk, el.encoding);
   });
 
   if (data)