func ConvertToUTF8String(charset string, textBytes []byte) (string, error) {
	if strings.ToLower(charset) == utf8 {
		return string(textBytes), nil
	}
	csentry, ok := encodings[strings.ToLower(charset)]
	if !ok {
		return "", fmt.Errorf("Unsupported charset %q", charset)
	}
	input := bytes.NewReader(textBytes)
	reader := transform.NewReader(input, csentry.e.NewDecoder())
	output, err := ioutil.ReadAll(reader)
	if err != nil {
		return "", err
	}
	return string(output), nil
}
func ConvertToUTF8String(charset string, textBytes []byte) (string, error) {
	if strings.ToLower(charset) == utf8 {
		return string(textBytes), nil
	}
	csentry, ok := encodings[strings.ToLower(charset)]
	if !ok {
		return "", fmt.Errorf("Unsupported charset %q", charset)
	}
	input := bytes.NewReader(textBytes)
	reader := transform.NewReader(input, csentry.e.NewDecoder())
	output, err := ioutil.ReadAll(reader)
	if err != nil {
		return "", err
	}
	return string(output), nil
}
func ConvertToUTF8String ( charset string , textBytes [ ] byte ) ( string , error ) { if strings . ToLower ( charset ) == utf8 { return string ( textBytes ) , nil } csentry , ok := encodings [ strings . ToLower ( charset ) ] if ! ok { return " " , fmt . Errorf ( " " , charset ) } input := bytes . NewReader ( textBytes ) reader := transform . NewReader ( input , csentry . e . NewDecoder ( ) ) output , err := ioutil . ReadAll ( reader ) if err != nil { return " " , err } return string ( output ) , nil }
// ConvertToUTF8String uses the provided charset to decode a slice of bytes into a normal
// UTF-8 string.
ConvertToUTF8String uses the provided charset to decode a slice of bytes into a normal UTF - 8 string .