> I added the following to test what encoding my Struts app is using > > <% > response.setContentType("text/html; charset=UTF-8"); > System.out.println(response.getCharacterEncoding()); > %> > > But it still print out the "ISO-8859-1", why? How can I set > the contentType to "text/html; charset=UTF-8"
This is just a hunch, but, I suspect you can't change the character encoding after you have started writing content to the stream. In that case, your best bet is to do this at the very top of the JSP page: <%@ page contentType="text/html;charset=UTF-8" language="java" %> Also, there is another consideration if you are using Tiles. Again this is just a hunch, but, I suspect that you would have to have that directive as the first line of your Tiles master layout template JSP. The concept mentioned above for a single page applies to a Tiles page generated dynamically from multiple JSPs all writing to the same response stream. We ran into something like this using the Struts template custom tags with Struts 1.0 back in 2001. We were correctly setting the character encoding using the page directive on individual content JSPs, but, had left it off our master page layout template JSP. So, it never took until we tracked that down. Duh! Hope this helps, Van Mike Van Riper mailto:[EMAIL PROTECTED] http://www.baychi.org/bof/struts --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]