add charsetreader to xmlreader
This commit is contained in:
parent
454eff0155
commit
646519e074
7 changed files with 19 additions and 6 deletions
|
|
@ -1,6 +1,9 @@
|
|||
package feed
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"io"
|
||||
"golang.org/x/net/html/charset"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
|
@ -13,6 +16,13 @@ func firstNonEmpty(vals ...string) string {
|
|||
return ""
|
||||
}
|
||||
|
||||
func xmlDecoder(r io.Reader) *xml.Decoder {
|
||||
decoder := xml.NewDecoder(r)
|
||||
decoder.Strict = false
|
||||
decoder.CharsetReader = charset.NewReaderLabel
|
||||
return decoder
|
||||
}
|
||||
|
||||
// taken from github.com/mjibson/goread
|
||||
var dateFormats = []string{
|
||||
time.RFC822, // RSS
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue