Created
September 1, 2014 03:53
-
-
Save missdeer/54570737b21a11e124c6 to your computer and use it in GitHub Desktop.
unmarshal non-utf8 xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "code.google.com/p/go.net/html/charset" | |
ad := &models.ArticleDocument{} | |
d := xml.NewDecoder(bytes.NewReader([]byte(xmldoc))) | |
d.CharsetReader = func(s string, r io.Reader) (io.Reader, error) { | |
return charset.NewReader(r, s) | |
} | |
d.Decode(ad) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment