Question

I'm using Django 1.2, and am having trouble generating good XML for a podcast. Any titles containing single-quotes, double-quotes or ampersands appear to be double-escaped, looking like this:

<title>Podcast: &amp;quot;But we had hoped...&amp;quot;</title>

Which means that they show up like this:

Podcast: &quot;But we had hoped&quot;

I did find this ticket, but it was closed ages ago.

I'm generating my feed using this snippet, and I'm just stuffing a value in a model field into the self.title bit, like this:

class iTunesPodcastPost():
  def __init__(self, talk):
    self.id = talk.id
    self.approval_date_time = talk.created
    self.title = talk.title # Looks wonky
    self.summary = talk.details # Looks fine
    self.enclosure_url = talk.mp3.url
    self.enclosure_length = talk.mp3.size
    self.enclosure_mime_type = u'audio/mpeg'
    self.duration = '%s' % talk.seconds
    self.explicit = u'clean'
    self.info_url = talk.get_absolute_url()

In case it helps, the podcast feed is here.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top