🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
> ### GBK 转 UTF8 ~~~ package main import ( "os/exec" "bytes" "golang.org/x/text/transform" "golang.org/x/text/encoding/simplifiedchinese" "io/ioutil" "fmt" ) func main() { cmd := exec.Command("ipconfig") buf, err := cmd.Output() if err != nil { fmt.Println(err) } r := bytes.NewReader(buf) r2 := transform.NewReader(r, simplifiedchinese.GBK.NewDecoder()) buf2, _ := ioutil.ReadAll(r2) fmt.Println(string(buf2)) } ~~~