Skip to content

Commit

Permalink
Update main.go
Browse files Browse the repository at this point in the history
  • Loading branch information
sbouchet authored Oct 12, 2023
1 parent 77ba981 commit c0d947a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package main

import (
"context"
//"html"
"html"
"log"
"os"
"sort"
Expand Down Expand Up @@ -84,14 +84,14 @@ func main() {
// remove <?xml version="1.0" encoding="UTF-8"?>
data = strings.Replace(data, `<?xml version="1.0" encoding="UTF-8"?>`, "", 1)
// replace &&
data = strings.Replace(data, "&&", "&#38;&#38;", -1)
data = strings.Replace(data, "&amp;&amp;", "&amp;amp;&amp;amp", -1)


f, err := os.OpenFile("rss.xml", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0755)
if err != nil {
log.Fatal(err)
}
if _, err := f.Write([]byte(data)); err != nil {
if _, err := f.Write([]byte(html.UnescapeString(data))); err != nil {
log.Fatalf("failed to write rss file: %s", err)
}
if err := f.Close(); err != nil {
Expand Down

0 comments on commit c0d947a

Please sign in to comment.