[英]Unix base64 encoding mismatch
I've been seeing some discrepancies in the base64 encoding in many utils from the unix util for ex: in java and python if I encode b
I get Yg==
but in unix I get Ygo=
I need to use b64 from unix in java and python. 我一直在从unix util for ex的许多utils中看到base64编码中的一些差异:在java和python中,如果我对
b
进行编码,我会得到Yg==
但是在unix中我会得到Ygo=
我需要在Java中使用unix的b64和python。 How do I make them consistent? 如何使它们一致?
Suppress the newline. 禁止换行符。
echo -n "b" | ...
Or add it. 或添加它。
>>> 'b\n'.encode('base64')
'Ygo=\n'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.