Skip to content

Instantly share code, notes, and snippets.

@stevebest
Created August 4, 2010 16:57
Show Gist options
  • Select an option

  • Save stevebest/508438 to your computer and use it in GitHub Desktop.

Select an option

Save stevebest/508438 to your computer and use it in GitHub Desktop.
var Buffer = require('buffer').Buffer,
assert = require('assert');
// This string encodes single '.' character in UTF-16
// prepended with BOM (\ufeff).
var dot = new Buffer('//4uAA==', 'base64');
// These pass
assert.equal(dot[0], 0xff);
assert.equal(dot[1], 0xfe);
assert.equal(dot[2], 0x2e);
assert.equal(dot[3], 0x00);
// This fails
assert.equal(dot.toString('base64'), '//4uAA==');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment