Unmarshal an ISO-8859-1 XML input in Go

后端 未结 6 830
时光说笑
时光说笑 2020-12-09 15:48

When your XML input isn\'t encoded in UTF-8, the Unmarshal function of the xml package seems to require a CharsetReader.

Where do you find

6条回答
  •  既然无缘
    2020-12-09 16:28

    There aren't any provided in the go distribution at the moment, or anywhere else I can find. Not surprising as that hook is less than a month old at the time of writing.

    Since a CharsetReader is defined as CharsetReader func(charset string, input io.Reader) (io.Reader, os.Error), you could make your own. There's one example in the tests, but that might not be exactly useful to you.

提交回复
热议问题