[opencms-dev] Re: OT: JSP & UTF-8

Joe Desbonnet jdesbonnet at gmail.com
Fri Oct 20 02:38:06 CEST 2006


I finally tracked that down to the presence of both commons-logging
and log4j libraries. Despite not being used in anyway, if *both*
libraries are present in WEB-INF/lib then JSP character encoding
mis-behaves. Bizarre. At least I now know where to direct my question.

Apologies again for the off-topic query.

Joe.

On 10/19/06, Joe Desbonnet <jdesbonnet at gmail.com> wrote:
> Apologies -- this is off-topic, but I thought the right people might
> be here to give me some ideas:
>
> I have a policy of working exclusively with UTF-8 for webapps. However
> I have found that refactoring existing webapps to use UTF-8 is for
> some reason surprisingly difficult. Take a look at the following two
> JSPs: (one takes a text field in a form and the other displays the
> text field)
>
> test.jsp:
> <%@page contentType="text/html; charset=UTF-8"
> %><form action="test-submit.jsp" method="POST">
> some text: <input type="text" name="text" size="16" />
> <input type="submit" value="Send" />
> </form>
>
> test-submit.jsp:
> <%@page contentType="text/html; charset=UTF-8"
> %><% request.setCharacterEncoding("UTF-8"); %>
> text=<%=request.getParameter("text")%>
>
> I've got these two scripts in two separate webapps in the same
> instance of Tomcat. It works correctly in one webapp and not the
> other.
> ie in one "á"  is displayed as "á"
> and in the other "á" is mangled to "á"
> (ie the UTF-8 is being intrepreted as ISO-8859-1)
>
> Both set of scripts are identical, run on the same browser and it's in
> the same tomcat, only the webapp context is different -- so I'm
> guessing this must be some environment setup in web.xml
>
> Any suggestions as to what I should try? I'm running Tomcat 5.5.16
> with JDK 1.5.0_07 on Linux (in the Eclipse environment).
>
> Any suggestions would be greatly appreciated.
>
> Thanks,
> Joe.
>



More information about the opencms-dev mailing list