Ticket #3759: update_feeds.diff

File update_feeds.diff, 1.3 KB (added by derelm, 18 years ago)
  • update_feeds.py

     
    1414    for feed in Feed.objects.filter(is_defunct=False):
    1515        parsed_feed = feedparser.parse(feed.feed_url)
    1616        for entry in parsed_feed.entries:
    17             title = entry.title.encode(parsed_feed.encoding, "xmlcharrefreplace")
    18             guid = entry.get("id", entry.link).encode(parsed_feed.encoding, "xmlcharrefreplace")
    19             link = entry.link.encode(parsed_feed.encoding, "xmlcharrefreplace")
     17            title = entry.title.encode("utf8", "xmlcharrefreplace")
     18            guid = entry.get("id", entry.link).encode("utf8", "xmlcharrefreplace")
     19            link = entry.link.encode("utf8", "xmlcharrefreplace")
    2020
    2121            if hasattr(entry, "summary"):
    2222                content = entry.summary
     
    2626                content = entry.description
    2727            else:
    2828                content = u""
    29             content = content.encode(parsed_feed.encoding, "xmlcharrefreplace")
     29            content = content.encode("utf8", "xmlcharrefreplace")
    3030
    3131            if entry.has_key('modified_parsed'):
    3232                date_modified = datetime.datetime.fromtimestamp(time.mktime(entry.modified_parsed))
Back to Top