support xml encoding other than utf-8

This commit is contained in:
Jianfei Wang 2015-03-06 15:10:57 +08:00
parent 4191d8a850
commit 4566387de9

View File

@ -20,6 +20,8 @@ import (
"net/http"
"net/url"
"golang.org/x/net/html/charset"
"github.com/huin/goupnp/httpu"
"github.com/huin/goupnp/ssdp"
)
@ -104,6 +106,7 @@ func requestXml(url string, defaultSpace string, doc interface{}) error {
decoder := xml.NewDecoder(resp.Body)
decoder.DefaultSpace = defaultSpace
decoder.CharsetReader = charset.NewReaderByName
return decoder.Decode(doc)
}