JSP produces wrong character output after form post

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.

 Adobe

Få hjelp raskere og enklere

Ny bruker?

Adobe MAX 2024

Adobe MAX
Kreativitetskonferansen

14.–16. oktober, Miami Beach og på nettet

Adobe MAX

Kreativitetskonferansen

14.–16. oktober, Miami Beach og på nettet

Adobe MAX 2024

Adobe MAX
Kreativitetskonferansen

14.–16. oktober, Miami Beach og på nettet

Adobe MAX

Kreativitetskonferansen

14.–16. oktober, Miami Beach og på nettet