java.lang.IllegalArgumentException: bad base-64

你说的曾经没有我的故事 提交于 2019-12-02 07:10:19
Mahm00d

You are trying to decode 26.919047981500626 which you can't. Because it's not a valid base64 encoded string.

When put into this online base64 decoder, it gives this error:

The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.

Update:

If you want to know the valid formatting of a encoded base64 string, take a look at the table in the wikipedia article and also this answer which shows a base64 validator code in C#.

It hit me, if in any case your are splitting the data & the encoding it, then decode it first before putting it back together.. Stupidly I was doing decode after collation of data that left me "bad-base-64" as each block of encode data had file enders(==).

This is Linkis handy anyways to validate the encoding and decoding.

remove the prefix string " data:image/png;base64, ", get the string of after "data:image/png;base64,", it can decode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!