diff options
| -rw-r--r-- | cmd/web/handlers/export.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/cmd/web/handlers/export.go b/cmd/web/handlers/export.go index bae5687..3f18a7f 100644 --- a/cmd/web/handlers/export.go +++ b/cmd/web/handlers/export.go @@ -1,6 +1,7 @@ package handlers import ( + "bytes" "database/sql" "encoding/xml" "log" @@ -104,5 +105,14 @@ func (ctx *rssExportContext) feed(w http.ResponseWriter, r *http.Request) { return } + // Really stupid workaround. + // Basically, encoders will escape HTML automatically. + // This can be configured on the JSON encoder. + // It cannot on the XML. + // God only knows why. + out = bytes.Replace(out, []byte("&"), []byte("&"), -1) + out = bytes.Replace(out, []byte(">"), []byte(">"), -1) + out = bytes.Replace(out, []byte("<"), []byte("<"), -1) + w.Write([]byte(xml.Header + `<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">` + string(out) + `</rss>`)) } |
