java.lang.IllegalArgumentException: bad base-64

后端 未结 3 872
野趣味
野趣味 2021-01-21 00:01

I am trying to encode and decode a String using android.util.Base64, but it gives a bad base-64 error.

The code with the problem is:

private byte[] base         


        
3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-21 00:38

    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#.

提交回复
热议问题