Apache CommonのBase64エンコーディング機能を使用しようとしています。しかし、私は "間違った"結果を得ているようです。ドキュメントはhereです。Apache base64エンコーディングの出力が「間違っている」共通
私のコードは次のようである:私は、Pythonを使用して同じ文字列をエンコードしかし
import org.apache.commons.codec.binary.Base64;
String data = "hi,all,how can this happen?";
byte[] databytes = Base64.encodeBase64(data.getBytes());
data = databytes.toString();
System.out.println(data);
//the result is:
//[[email protected]
、コードは次のとおりです。
import base64
print base64.b64encode("hi,all,how can this happen?")
#The result is aGksYWxsLGhvdyBjYW4gdGhpcyBoYXBwZW4/
どのような違いがあることができますか?
そのをエンコードします。 – Dan675
'@'が有効なBase64 charではないことを認識しませんでしたか?あなたは 'byte []'オブジェクトの 'toString()'を呼び出しています。 – st0le
新しい文字列(データ)を使用します。 –