0
0
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:
koichik 2011-04-28 15:38:28 +09:00 committed by Ryan Dahl
parent 1343ee8d54
commit fcc04e67c8
2 changed files with 6 additions and 1 deletions

View File

@ -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');

View File

@ -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'), 'あいうえお');