llegal base64 character 20
时间: 2024-01-04 19:52:23 浏览: 78
legal64and32sublime
"llegal base64 character 20"是一个错误的提示,表示在解码base64字符串时遇到了非法字符20。根据引用中提到的,如果使用Java JDK的Base64进行解码,需要注意如果是url地址栏传参,可能需要进行UrlDecode一次。否则,base64中的加号" "会被替换成空格,导致解码失败。所以,解决这个问题的方法是使用URLDecoder对base64字符串进行解码,然后再使用Base64进行解码。例如,可以使用以下代码来解决这个问题:
String decodedString = URLDecoder.decode(base64String, "UTF-8");
byte[] decodedBytes = Base64.getDecoder().decode(decodedString);
String decodedResult = new String(decodedBytes, "UTF-8");
这样就可以正确解码含有非法字符20的base64字符串了。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [自学Android开发 Java和Android SDK的Base64](https://blog.csdn.net/Ym_quiet/article/details/123835335)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [Illegal base64 character 20](https://blog.csdn.net/qingqingxiaocao1989/article/details/123580931)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文