velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chenj...@uvic.ca
Subject #parse() and UTF-8 output problem
Date Fri, 11 Jun 2004 03:17:01 GMT
Hi,

In my web application, I have a Controller servlet which extends Velocity
Servlet. In the Controller servlet, I have

// set the request/response encoding once and for all
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html; charset=UTF-8");
response.setCharacterEncoding("UTF-8");

This has been working great, the HTML rendered is in UTF-8.

However, today I modified template so that the common parts get extracted.
So, instead of

<html>
<body>
content
</body>
</html>

I have

#parse("include/header.vm")
content
#parse("include/footer.vm")

But, when I run the web app, the browser displays two weird characters in
the html. When I looked at the html source, it is like

<html><body>
content
....

So there is no newline between <html><body> which was in the header.vm.

When I take the response.setxxxx() encoding off and run the app again, the
html page is good again.

So, I guess the encoding messed up the #parse() somehow. But could not
figure this out.

Any help is greatly appreciated!

Jian

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message