I am trying to do UTf 8 encoding to a string in node js
I have tried Buffer(someString, 'utf8') and also the package utf8 but it is always returning me the original string. var utf8 = require('utf8');
function decrypt(enc) {
console.log('type', typeof enc);
enc = utf8.encode(enc);
console.log('encoding', enc);
return enc;
}
console.log('decrypted:', decrypt('message'));
I used 'message' string in this https://mothereff.in/utf-8 and the desired result is not coming as expected. How do we do the encoding?