javascript - CryptoJS not decrypting non-Latin characters faithfully -


i trying use cryptojs aes, so:

var msg = "café"; var key = "something"; var c = cryptojs.aes.encrypt(msg, key).tostring(); cryptojs.aes.decrypt(c, key).tostring(cryptojs.enc.latin1); 

unfortunately returns café, not café. latin1 not right encoding use, can't find better one. there solution?

thanks.

you missing format
proper way using cryptojs.enc.utf8

so, please try:

cryptojs.aes.decrypt(c, key).tostring(cryptojs.enc.utf8);


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -