When using the base64 decode of the standard library, there will be an error of illegal characters. The following function is my test and it can be decrypted normally.
Pay attention to this parameter: base64.RawStdEncoding is the key to solving illegal characters
func Base64Decode(str string ) string { reader: = strings.NewReader(str) decoder: = base64.NewDecoder(base64.RawStdEncoding, reader) // Decoding buf in streaming mode := make([] byte , 1024 ) // Save the decoded data dst := "" for { n, err : = decoder.Read(buf) dst += string (buf[:n]) if n == 0 || err != nil { break } } return dst }
Read More:
- [Solved] Go language gob serialization pointer cannot be addressed Error
- Go Language Error: main redeclared in this block [How to Solve]
- [Solved] URIError: Failed to decode param ‘/%3C%=%20BASE_URL%20%3Estatic/index.%3C%=%20VUE_APP_INDEX_CSS_HASH%20%3E.css’
- [Solved] error C2041: illegal digit ‘9‘ for base ‘8‘ | error C2059: syntax error: ‘bad suffix on number‘
- Java handles special characters in URL
- How to Solve ES error: “illegal_argument_exception”
- [Solved] Golang Error: main.go:5:2: package go_code/chapter10/factory/model is not in GOROOT
- R language learning problem solving error in output $nodeid: $operator is invalid for atomic vectors
- R Language: How to Solve featureplot function Error
- R language: How to Solve DMwR Install Error
- Go declares that the local variable does not use command line arguments. Main. Go: 4:6: a declared but not used
- [Solved] .\main.go:3:6: missing function body .\main.go:4:1: syntax error: unexpected semicolon or newline be
- How to Solve Go Error: concurrent map iteration and map write
- [Solved] Springboot WARNING: All illegal access operations will be denied in a future release
- [Solved] Error running ‘go build myfir_go_project‘: Cannot run program
- How to Solve Docker Run Error: standard_init_linux.go:219: exec user process caused: exec format error
- [Go] Testing when solving go test: warning: no tests to run
- srs Error: demux SPS/PPS : avc decode sequence header
- [Solved] error converting to execution character set illegal byte sequence