Input byte array has incorrect ending byte at 40

后端 未结 3 1360
攒了一身酷
攒了一身酷 2021-02-19 00:32

I have a string that is base64 encoded. It looks like this:

eyJibGExIjoiYmxhMSIsImJsYTIiOiJibGEyIn0=

Any online tool can decode this to the pro

3条回答
  •  终归单人心
    2021-02-19 00:34

    Okay, I found out. The original String is encoded on an Android device using android.util.Base64 by Base64.encodeToString(json.getBytes("UTF-8"), Base64.DEFAULT);. It uses android.util.Base64.DEFAULT encoding scheme.

    Then on the server side when using java.util.Base64 this has to be decoded with Base64.getMimeDecoder().decode(payload) not with Base64.getDecoder().decode(payload)

提交回复
热议问题