Problems with character encoding when presenting in XML format

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Problems with character encoding when presenting in XML format

dom_runner
This post was updated on .
Friends.

I'm new to Grails and have stumbled upon an encoding problem. Need your help.

The website I'm working on has several Swedish characters. When Swedish characters are presented, fetched from the database, in HTML format in a .gsp file the Swedish characters are presented as expected. Meaning ÅÄÖ are presented by the view in a correct format. So far so good. But when I render the exact same content in a .gsp file with XML formatting the characters above are presented encoded as follows: "Aring;"/"Ouml;"/"Auml;".

I have added the following tag at the top of my XML .gsp page:
<%@ page contentType="text/xml; charset=UTF-8" %>

The following values are set in the Config.groovy file:
// The default codec used to encode data with ${}
grails.views.default.codec = "html" // none, html, base64
grails.views.gsp.encoding = "UTF-8"
grails.converters.encoding = "UTF-8"

When accessing this XML .gsp view using a Chrome browser I get the following error message:
This page contains the following errors:
error on line 2164 at column 20: Entity 'Ouml' not defined

I don't want any major configuration changes since the application is already running well with its generated HTML views. But I need my XML REST API to work as expected.

How can I solve this?

Thanks in advance!