title: Setting encoding in Grails controller's render method
body: <p>I'm trying to build an RSS feed using Grails and Rome.</p>
  
  <p>In my controller's rss action, my last command is :</p>
  
  <pre><code>render(text: getFeed("rss_2.0"), contentType:"application/rss+xml", encoding:"ISO-8859-1 ")  
  </code></pre>
  
  <p>However, when I navigate to my feed's URL, the header is :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
      &lt;rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"&gt;
      ...
  </code></pre>
  
  <p>My code for getFeed() is something like :  </p>
  
  <pre><code>def getFeed(feedType) {
      def currentFeedURL = params.url
  
      def items = parserService.parse(new URL(currentFeedURL))
  
      def feedLink = "http://blablabla"
  
      def feedEntries = []
  
  
      items.each { item -&gt;
          def entryTitle 
          if (item.price != null)
              entryTitle = item.description + " - " + item.price + " euros"
          else 
              entryTitle = item.description
  
          def itemContent = new SyndContentImpl(type:'text/plain', value: getBody(item))   
  
          SyndEntryImpl entry = new SyndEntryImpl(title: entryTitle,
                  link: item.link,
                  publishedDate: item.date,
                  description: itemContent)
          feedEntries.add(entry)
  
      }
  
      def feed = new SyndFeedImpl(feedType: feedType,
          encoding : "ISO-8859-1",
          title: 'Some title',
          link: 'http://acme.com',
          description: 'Feed description',
          entries: feedEntries)
  
  
      StringWriter writer = new StringWriter()
      SyndFeedOutput output = new SyndFeedOutput()
      output.output(feed,writer)
      writer.close()
      return writer.toString()
  }
  </code></pre>
  
  <p>And my getBody(item) is just parsing an item and outputting some HTML formatted text.</p>
  
  <p>Does anyone have a clue about WHY the encoding is UTF-8 when I set it to ISO-8859-1 in the render method ???</p>
  
  <p>Thanks for your help !</p>