You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The output_encoding specifies the output format of the enciphered data, and can be 'latin1', 'ascii' or 'utf8'.
the utf16le is not supported as output encoding, but it works if you specify 'utf16le'.
The change in lib/crypto.js fix the issue with utf-8, but not with utf-16le.
There is a function 'normalizeEncoding' in lib/internal/util.js that can be used to normalize the encoding.
The text was updated successfully, but these errors were encountered:
Normalize the encoding in getDecoder() before using it. Fixes an
AssertionError: "Cannot change encoding" when encoding is "ucs2",
"ucs-2" or "utf-16le"
Fixes: nodejs#8236
Normalize the encoding in getDecoder() before using it. Fixes an
AssertionError: "Cannot change encoding" when encoding is "ucs2",
"ucs-2" or "utf-16le"
Fixes: #8236
PR-URL: #8301
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
I've got similar issue as:
#5655
when I'm using as output encoding 'ucs2', 'usc-2' or 'utf-16le'. If I'm using 'utf16le' the code works.
Here is the not working code:
var decrypted = decipher.update(value, 'base64', 'usc2');
Output:
Stack: AssertionError: Cannot change encoding at getDecoder (crypto.js:105:3) at Decipheriv.Cipher.update (crypto.js:146:21)
and here the working one:
var decrypted = decipher.update(value, 'base64', 'utf16le');
According to the documentation:
the utf16le is not supported as output encoding, but it works if you specify 'utf16le'.
The change in lib/crypto.js fix the issue with utf-8, but not with utf-16le.
There is a function 'normalizeEncoding' in lib/internal/util.js that can be used to normalize the encoding.
The text was updated successfully, but these errors were encountered: