-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aesCbc.decrypt not suport emoji #76
Comments
I also have the same problem whith decript the emoji string. how can I fix it. |
use base64 to wrap it for now… |
I had solve the problem. relace the method 【convertUtf8】 in the index.js
|
Should this fix be implemented? |
I plan to remove the UTF-8 libraries entirely from aes-js in the next version as there are many, much more complete implementations, and it has been a source of confusion for many people using UTF-8 strings not realizing they are viable as a binary encoding. For a more complete implementation, please see my ethers.js library: There are a lot of additional edge cases these libraries handle, which are essential for security focused applications. The UTF-8 coding by themselves is as large as the entire AES cipher. :) |
How can i do that? can you explain? |
i can't find any solution, the emojis destroy my json string |
I used @hdwang123's solution above and it worked for me as a replacement for |
You can also just use the built-in TextEncoder API. new TextEncoder('utf-8').encode(text);
new TextDecoder('utf-8').decode(bytes); |
I found aes-js's aesCbc.decrypt can't decrypt string with emoji , such as 🍩 🙃 .
details :
first , I use php encrypt a string ,and then decrypt it
output:
It works fine which means the encrypted stirng is right.
then , when I decrypt it with aes-js , 🙃 destoried .
output:
The text was updated successfully, but these errors were encountered: