0
Grails와 Rome을 사용하여 RSS 피드를 작성하려고합니다. 내 컨트롤러의 RSS 행동에Grails 컨트롤러의 렌더링 방법 설정 인코딩
, 내 마지막 명령은 다음과 같습니다
render(text: getFeed("rss_2.0"), contentType:"application/rss+xml", encoding:"ISO-8859-1 ")
그러나, 나는 내 피드의 URL로 이동하는 경우, 헤더는 다음과 같습니다
이<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
...
getFeed에 대한 나의 코드는()이다 다음과 같습니다 :
def getFeed(feedType) {
def currentFeedURL = params.url
def items = parserService.parse(new URL(currentFeedURL))
def feedLink = "http://blablabla"
def feedEntries = []
items.each { item ->
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()
}
내 getBody (항목)은 항목을 구문 분석하고 일부 HTML 형식으로 출력하는 것입니다. 텍스트.
누구나 렌더링 방법에서 ISO-8859-1로 설정할 때 인코딩이 UTF-8 인 이유에 대한 단서가 있습니까 ???
도움 주셔서 감사합니다.