DecodedLen
returns the maximal length.
This length is useful for sizing your buffer but part of the buffer won't be written and thus won't be valid UTF-8.
You have to use only the real written length returned by the Decode
function.
l, _ := base64.StdEncoding.Decode(base64Text, []byte(message))
log.Printf("base64: %s
", base64Text[:l])
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…