From e232cf3100a232ba824bf04fb8dd0bf39cb27373 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Thu, 1 Apr 2010 16:24:31 -0700 Subject: [PATCH] Hack to support UTF8 writes again! --- lib/net.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/net.js b/lib/net.js index db41bd695a..a4b2e4ad41 100644 --- a/lib/net.js +++ b/lib/net.js @@ -452,7 +452,10 @@ Stream.prototype._writeOut = function (data, encoding) { if (encoding == 'utf8' || encoding == 'utf-8') { bytesWritten = pool.utf8Write(data, pool.used); - charsWritten = bytesWritten; // XXX FIXME + // XXX Hacky way to find out the number of characters written. + // Waiting for a more optimal way: http://codereview.chromium.org/1539013 + var _s = pool.utf8Slice(pool.used, pool.used + bytesWritten); + charsWritten = _s.length; } else if (encoding == 'ascii') { bytesWritten = pool.asciiWrite(data, pool.used); charsWritten = bytesWritten;