diff --git a/lib/net.js b/lib/net.js index 93e9366af8..59ee2d0421 100644 --- a/lib/net.js +++ b/lib/net.js @@ -215,7 +215,7 @@ Socket.prototype._sendString = function (data, encoding) { charsWritten = buffer.utf8Write(data, buffer.used, buffer.length - buffer.used); - bytesWritten = process.Buffer.utf8Length(data.slice(0, charsWritten)); + bytesWritten = process.Buffer.utf8ByteLength(data.slice(0, charsWritten)); } else { // ascii buffer.isFd = false; diff --git a/src/node_buffer.cc b/src/node_buffer.cc index 522d3f520f..71afbd7156 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -327,8 +327,8 @@ Handle Buffer::Unpack(const Arguments &args) { } -// var nbytes = Buffer.utf8Length("string") -Handle Buffer::Utf8Length(const Arguments &args) { +// var nbytes = Buffer.utf8ByteLength("string") +Handle Buffer::Utf8ByteLength(const Arguments &args) { HandleScope scope; if (!args[0]->IsString()) { return ThrowException(Exception::TypeError(String::New( @@ -368,7 +368,9 @@ void Buffer::Initialize(Handle target) { NODE_SET_PROTOTYPE_METHOD(constructor_template, "asciiWrite", Buffer::AsciiWrite); NODE_SET_PROTOTYPE_METHOD(constructor_template, "unpack", Buffer::Unpack); - NODE_SET_METHOD(constructor_template->GetFunction(), "utf8Length", Buffer::Utf8Length); + NODE_SET_METHOD(constructor_template->GetFunction(), + "utf8ByteLength", + Buffer::Utf8ByteLength); target->Set(String::NewSymbol("Buffer"), constructor_template->GetFunction()); } diff --git a/src/node_buffer.h b/src/node_buffer.h index 793c934615..ae3b6bfbff 100644 --- a/src/node_buffer.h +++ b/src/node_buffer.h @@ -45,7 +45,7 @@ class Buffer : public ObjectWrap { static v8::Handle Utf8Slice(const v8::Arguments &args); static v8::Handle AsciiWrite(const v8::Arguments &args); static v8::Handle Utf8Write(const v8::Arguments &args); - static v8::Handle Utf8Length(const v8::Arguments &args); + static v8::Handle Utf8ByteLength(const v8::Arguments &args); static v8::Handle Unpack(const v8::Arguments &args); int AsciiWrite(char *string, int offset, int length);