2018-02-05T15:05:26Z||2018-02-05T15:05:26Z


示例来自Go官网.

编码:

package main

import (
	"encoding/base64"
	"fmt"
)

func main() {
	msg := "Hello, 世界"
	encoded := base64.StdEncoding.EncodeToString([]byte(msg))
	fmt.Println(encoded)
	decoded, err := base64.StdEncoding.DecodeString(encoded)
	if err != nil {
		fmt.Println("decode error:", err)
		return
	}
	fmt.Println(string(decoded))
}

输出:

SGVsbG8sIOS4lueVjA==
Hello, 世界