nickva commented on issue #3924:
URL: https://github.com/apache/couchdb/issues/3924#issuecomment-1030651938
Thanks for reaching out, @vkuznet
`echo` adds a newline at the end so the encoded stream is not what we expect
usually.
In general ,`echo` and `base64` command line combination are not best way to
encode data because of that reason
python could work here or any other language which has a base64 encoder:
```
In [1]: import base64
In [2]: s = "admin:admin"
In [3]: base64.b64encode(s.encode("utf-8")).decode("utf-8")
Out[3]: 'YWRtaW46YWRtaW4='
```
Notice that the encoded string is different than:
```
echo "admin:admin" | base64
YWRtaW46YWRtaW4K
```
One way to handle it in the shell is to pass `-n` to echo so it doesn't
include the newline in the stream:
```
echo -n "admin:admin" | base64
YWRtaW46YWRtaW4=
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]