且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Base64:java.lang.IllegalArgumentException:非法字符

更新时间:2022-04-30 10:05:12

您的编码文本是 [B @ 6499375d 。这不是Base64,在编码时出现问题。解码代码看起来不错。

Your encoded text is [B@6499375d. That is not Base64, something went wrong while encoding. That decoding code looks good.

使用此代码将byte []转换为String,然后再将其添加到URL中:

Use this code to convert the byte[] to a String before adding it to the URL:

String encodedEmailString = new String(encodedEmail, "UTF-8");
// ...
String confirmLink = "Complete your registration by clicking on following"
    + "\n<a href='" + confirmationURL + encodedEmailString + "'>link</a>";