I seem to have a problem of consistency between UTF-8 and ISO-8859-1 when it comes to accepting Strings in forms. Here's how it goes:
* My application is intended to be entirely UTF-8 encoded: the database, the JSP files, etc. Only exceptions are the localized ApplicationResources_??.properties files, which are encoded as ISO-8859-1, as per http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html That part works very well. * I use Tiles, and I include the following line at the beginning of every tile and every layout page: <%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8"%> * Also, in the tile that generates the <HEAD> of the HTML files, I include the following: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> So far, everything works fine and all the localized messages display properly with all the desired accents and diacritic signs. Everything... except in the case of a text form: <html:form action="/search" acceptCharset="UTF-8"> <html:text property="query"/><br/> <html:submit titleKey="search.search" > <bean:message key="search.executeSearch" /> </html:submit> </html:form> The ActionForm is defined dynamically in the struts-config.xml file: <form-bean name="NameSearchForm" type=" org.apache.struts.action.DynaActionForm"> <form-property name="query" type="java.lang.String" /> </form-bean> And the Action: <action path="/search" name="NameSearchForm" scope="request" type="com.mystuff.NameSearchAction" validate="false"> <forward name="results" path=".results" redirect="false" /> <forward name="noresult" path=".noresult" redirect="false" /> </action> On input of a query string, the NameSearchAction retrieves this string: String queryStr = (String) PropertyUtils.getSimpleProperty(form, "query"); But that's where I get into trouble. Suppose, in the text form, I type the query "César" (the second letter being an e-acute). If on the following "noresult" JSP page, I re-display the content of the query, I then get: "CÃ(c)sar". (The second and third characters are now respectively an uppercase-A-tilde and a copyright-sign.) That, to me, looks like a conflict between ISO-8859-1 and UTF-8. Where's the catch? [Using Struts 1.3.5, Java 5, Tomcat 6.0; this experiment is run within Eclipse/MyEclipse 5.1.0.]