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.

本产品经 Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License 许可  Twitter™ 与 Facebook 中的内容不在 Creative Commons 的条款约束之下。

法律声明   |   在线隐私策略