velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Searle <>
Subject Page encoding - confused
Date Fri, 16 Dec 2005 09:55:40 GMT


Using the VelocityViewServlet and I can't get it to play properly with

We have a file on disk - in UTF-8 encoding. I need to return the
contents of this as part of an HTML response to the browser (this is
the test case - the real life situation is more complex).

So this is loaded from disk (from a struts action) using a
BufferedInputStream specified to have UTF-8 encoding.

The content of this is stored in a java String.

The string is then set as a request parameter which in the velocity
template is referenced.

The file has


as well as a velocimacro.library setting which is used - so the file
is being read.

And on startup the log says:

Velocity   [info] VelocityViewServlet: Default content-type is: text/html; charset=UTF-8

So - as far as I can see - that should give that when this particular
action is called via the web app then the content of the file is
returned to the user in UTF-8.

The content itself (xhtml) starts

<?xml version="1.0" encoding="UTF-8"?>

But - and this is the issue - the content (xhtml body) itself is
returned to the browser encoded in iso-8859-1 (which is the encoding
that tomcat is running under - and which I can't change - mine is not
the only app on this server).

I've obviously missed a step somewhere here - any hints?

Chris Searle

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message