Skip to content

Instantly share code, notes, and snippets.

@Kikobeats
Created January 4, 2017 08:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kikobeats/e852c8ecae43a22f8194f6610cff5d98 to your computer and use it in GitHub Desktop.
Save Kikobeats/e852c8ecae43a22f8194f6610cff5d98 to your computer and use it in GitHub Desktop.
var utf8 = require('utf8');
var val1 = utf8.decode('\xE2\x80\x99');
const StringDecoder = require('string_decoder').StringDecoder;
const decoder = new StringDecoder('utf8');
const symbol = new Buffer([0xE2, 0x80, 0x99]);
const val2 = decoder.write(symbol);
console.log(val1);
console.log(val2);
console.log(val1 === val2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment