I am getting: error: illegal base64 data at input byte 68 When passing in base64_edcode string into base64.StdEncoding.DecodeString(str):
the string is:
TbHl6ijhdKwXklzOkw5+/r5Yac0kED8Iyp/7suphsFLHSJAUGM8vZHeroTeJ9eF4PePO5A
but put the string into php base64_decoed is ok result is 0000000000bd583f958a7018c9[11,"string",8641231,1111]
Why?
Because it's not a valid Base 64 string. It's missing the end padding. With proper padding:
TbHl6ijhdKwXklzOkw5+/r5Yac0kED8Iyp/7suphsFLHSJAUGM8vZHeroTeJ9eF4PePO5A==
it works, or you can tell the decoder not to look for padding:
out, err := base64.StdEncoding.WithPadding(base64.NoPadding).DecodeString(str)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With