Browse Source

Fix SlowBuffer.write() with 'ucs2' throws ReferenceError.

v0.7.4-release
koichik 14 years ago
committed by Ryan Dahl
parent
commit
fcc04e67c8
  1. 2
      lib/buffer.js
  2. 5
      test/simple/test-buffer.js

2
lib/buffer.js

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

5
test/simple/test-buffer.js

@ -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…
Cancel
Save