You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@sling.apache.org by Simon Gaeremynck <ga...@gmail.com> on 2010/02/26 16:12:31 UTC

Response encoding.

Hi all,

I have a (probably stupid) question about response encoding.
We have a couple of servlets who output some data. Sometimes that data
 contains characters like çäöåЦжФ .

Now, storing our data on nodes is easy as we pass in a _charset_=utf-8 in our requests each time.
However, when we want to display that data we've noticed that we have to set a 
content-type and character encoding in each servlet. I've also noticed that almost all the renderers 
in org.apache.sling.servlets.get do this.

resp.setContentType(req.getResponseContentType());
resp.setCharacterEncoding("UTF-8");

My question is, should we do this in each of our servlets as well or is there a way to do that automatically?
Without resorting to a Filter.

Kind regards,
simon