In my little Go program I grab an UTF-16 LE XML File from a Windoze Server.
I found a few hints on the internet how to handle the parsing with Go:
import (
"encoding/xml"
"golang.org/x/net/html/charset")
decoder := xml.NewDecoder(reader)
decoder.CharsetReader = charset.NewReaderLabel
err = decoder.Decode(&parsed)
This was posted on Stackoverflow by user moraes"golang.org/x/net/html/charset")
decoder := xml.NewDecoder(reader)
decoder.CharsetReader = charset.NewReaderLabel
err = decoder.Decode(&parsed)
<http://stackoverflow.com/users/125967/moraes>. But I still don´t
understand the basic procedure of handling UTF-16 files.
1. Do I have to convert the UTF-16 encoded file to UTF-8 prior to further
decode it with the above commands. Or will the "NewDecoder" handle this.
2. How do handle the line in the XML files which denotes the encoding. Do I
have to manually replace it with <?xml version="1.0" encoding="UTF-8"?>
Thanks for your input.
Tobias
--
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.