import (
"github.com/paulrosania/go-charset/charset"
_ "github.com/paulrosania/go-charset/data"
"encoding/xml"
"os"
)
...
d := xml.NewDecoder(os.Stdin)
d.CharsetReader = charset.NewReader
var s myType
err = d.Decode(&s)
This works for utf-8, iso-8859-1, others... but when I try to decode xml
that is in utf-16 (including a byte order mark) I get:
XML syntax error on line 1: invalid UTF-8
Using xml.Unmarshal gives the same error.
I know, utf16 is weird, but Windows programs seem to produce it. And
at http://www.opentag.com/xfaq_enc.htm it reads:
All XML processors must support at least UTF-8 and UTF-16.
So why isn't utf-16 (and utf-32) supported?
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.