Make encoding variable

This commit is contained in:
Jason Streifling 2024-04-04 16:52:53 +02:00
parent ba1b797b0f
commit edd8a49e8f

4
rss.go
View File

@ -229,7 +229,7 @@ func NewFeed() *Feed {
} }
} }
func (f *Feed) ToXML() (string, error) { func (f *Feed) ToXML(encoding string) (string, error) {
if err := f.check(); err != nil { if err := f.check(); err != nil {
return "", fmt.Errorf("error checking RSS feed: %v", err) return "", fmt.Errorf("error checking RSS feed: %v", err)
} }
@ -239,5 +239,5 @@ func (f *Feed) ToXML() (string, error) {
return "", fmt.Errorf("error XML encoding feed: %v", err) return "", fmt.Errorf("error XML encoding feed: %v", err)
} }
return `<?xml version="1.0" encoding="UTF-8"?>` + string(xml), nil return `<?xml version="1.0" encoding="` + encoding + `"?>` + string(xml), nil
} }