I noticed there is a problem with encoding non-ASCII text in UTF-8 encoding. For example, when we try to encode the text Тест, we receive the string IjVBQg==. However, when we attempt to decode this string, we receive the result "5AB, instead of the original string.
On the other hand, if we use the console base64 utility, such as echo -n Тест | base64 -w 0, we get 0KLQtdGB0YI=. In JavaScript, I obtain the same result if I use the utf8 encoding in the Buffer.from function: Buffer.from('Тест', 'utf8').toString('base64').
Hello,
I noticed there is a problem with encoding non-ASCII text in UTF-8 encoding. For example, when we try to encode the text
Тест
, we receive the stringIjVBQg==
. However, when we attempt to decode this string, we receive the result"5AB
, instead of the original string.On the other hand, if we use the console
base64
utility, such asecho -n Тест | base64 -w 0
, we get0KLQtdGB0YI=
. In JavaScript, I obtain the same result if I use theutf8
encoding in theBuffer.from
function:Buffer.from('Тест', 'utf8').toString('base64')
.Thank you.