func CharsetReader(charset string, input io.Reader) (io.Reader, error) {
	switch mapping[strings.ToLower(charset)] {
	case "utf-8":
		return input, nil
	case "iso-8859-1":
		return newISO88591CharsetReader(input), nil
	}
	return nil, fmt.Errorf("charset %q is not supported", charset)
}
CharsetReader implements the charset reader function for the XML decoder.
Currently UTF-8 and ISO-8859-1 are supported.
package utils
import (
	"bytes"
	"encoding/xml"
	"fmt"
	"html"
	"io"
	"os"
	"strings"
	"unicode/utf8"
)
type iso88591CharsetReader struct {
	reader io.ByteReader
	buffer *bytes.Buffer
}
func newISO88591CharsetReader(reader io.Reader) *iso88591CharsetReader {
	buffer := bytes.NewBuffer(make([]byte, 0, utf8.UTFMax))
	return &iso88591CharsetReader{reader.(io.ByteReader), buffer}
}
func (cr *iso88591CharsetReader) ReadByte() (b byte, err error) {
	if cr.buffer.Len() <= 0 {
		r, err := cr.reader.ReadByte()
		if err != nil {
			return 0, err
		}
		if r < utf8.RuneSelf {
			return r, nil
		}
		cr.buffer.WriteRune(rune(r))
	}
	return cr.buffer.ReadByte()
}
func (cr *iso88591CharsetReader) Read(p []byte) (int, error) {
	return 0, os.ErrInvalid
}
var mapping = map[string]string{
	"":                "utf-8",
	"utf-8":           "utf-8",
	"iso-8859-1":      "iso-8859-1",
	"iso_8859-1:1987": "iso-8859-1",
	"iso-ir-100":      "iso-8859-1",
	"iso_8859-1":      "iso-8859-1",
	"latin1":          "iso-8859-1",
	"l1":              "iso-8859-1",
	"ibm819":          "iso-8859-1",
	"cp819":           "iso-8859-1",
	"csisolatin1":     "iso-8859-1",
}