String test = "14234325346@123.com";
//加密
String base = Base64.getEncoder().encodeToString(test.getBytes());
System.out.println(base);
//解密
String s2 = new String(Base64.getDecoder().decode(base));
System.out.println(s2);
Illegal base64 character 20报错如何解决
//base64 编码中使用了加号(+),而 + 在 URL 传递时会被当成空格,替换处理一下
String messageUrls = messageUrl.replaceAll(" ","+");
该博客主要讨论了在Java中使用Base64进行字符串加密和解密的过程,并遇到'Illegal base64 character 20'的错误。博主提出了解决方案,即在URL传递Base64编码时需要替换加号(+)以避免被当作空格处理。此外,还提及了在URL编码中处理Base64字符串的必要性。

被折叠的 条评论
为什么被折叠?



