velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chenjian <chenj...@uvic.ca>
Subject #parse() and UTF-8 response encoding problem
Date Fri, 11 Jun 2004 03:35:28 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("xxxxxxx; charset=UTF-8"); 
response.setCharacterEncoding("UTF-8");

This has been working great, the web page rendered is in UTF-8. However, today 
I modified the template so that the common parts get extracted. So, instead of

header stuff
body content
footer stuff

I have

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

But, when I run the web app, the browser displays two weird characters in the 
web page. When I looked at the page source, the stuff in header.vm gets 
rendered with newline stripped off. So there is no newline which was in the 
header.vm. When I took the response.setxxxx() encoding off and run the app 
again, the web page was good again.

So, I guess the encoding messed up the #parse() somehow. But could not figure 
this out. Any help is greatly appreciated!



---------------------------------------------------------------------
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