Issue

When you submit a form with UTF-8 character input (not in the ISO-8859-1 charset) and the form output is written, the server outputs the wrong characters.

Solution

Set the content type to use UTF-8 encoding. For example:

<%@taglib uri="/libs/CFC/resources/jstl/c.tld" prefix="c" %> <form method="post"> <input name="searchterm" value="<c:out value="${param.searchterm}" />" /><input type="submit" /> </form>

Example:

When the user inserts "ä" (a-Umlaut) in a form field (input box) and clicks Submit, the input box shows "�" after the JSTL roundtrip.

The same sample JSP page works fine in other servlet engines.

Expected result:

The input box should show "ä" (a-Umlaut).

Example solution:

<%@ page contentType="text/html;encoding=UTF-8" %> <%@ taglib uri="/libs/CFC/resources/jstl/c.tld" prefix="c" %> <form method="post"> <input name="searchterm" value="<c:out value="${param.searchterm}" />" /><input type="submit" /> </form>

Additional information

This issue occurs when the default encoding in CQ Servlet Engine is ISO-8859-1.

Esta obra está autorizada con arreglo a la licencia de Reconocimiento-NoComercial-CompartirIgual 3.0 Unported de Creative Commons.  Los términos de Creative Commons no cubren las publicaciones en Twitter™ y Facebook.

Avisos legales   |   Política de privacidad en línea