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 授權  Creative Commons 條款未涵蓋 Twitter™ 與 Facebook 文章。

法律說明   |   線上隱私權政策