mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
Fix SlowBuffer.write() with 'ucs2' throws ReferenceError.
This commit is contained in:
parent
1343ee8d54
commit
fcc04e67c8
@ -100,7 +100,7 @@ SlowBuffer.prototype.write = function(string, offset, encoding) {
|
||||
|
||||
case 'ucs2':
|
||||
case 'ucs-2':
|
||||
return this.ucs2Write(start, end);
|
||||
return this.ucs2Write(string, offset);
|
||||
|
||||
default:
|
||||
throw new Error('Unknown encoding');
|
||||
|
@ -500,3 +500,8 @@ console.log(z.length)
|
||||
assert.equal(2, z.length);
|
||||
assert.equal(0x66, z[0]);
|
||||
assert.equal(0x6f, z[1]);
|
||||
|
||||
|
||||
var b = new SlowBuffer(10);
|
||||
b.write('あいうえお', 'ucs2');
|
||||
assert.equal(b.toString('ucs2'), 'あいうえお');
|
||||
|
Loading…
Reference in New Issue
Block a user