func (b *strBuffer) String() string { d := japanese.ISO2022JP.NewDecoder() result, _, err := transform.Bytes(d, b.data) if err != nil { panic(err) } return string(result) }
func Convert(charset, s string) (string, error) { charset = strings.Replace(charset, "-", "", -1) charset = strings.ToLower(charset) if charset == "utf8" { return s, nil } e := Encoding(charset) if e == nil { return "", ErrUnknownCharset } d := e.NewDecoder() res, _, err := transform.Bytes(d, []byte(s)) if err != nil { return "", err } return string(res), nil }