For some reason, if I type in this (to, say, the lastName field):
request.getParameterValues("lastName") looks like this:
This causes the database and the validation feedback to get polluted with this gibberish. I got stuff like this in the jsp:
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page contentType="text/html; charset=UTF-8" %>
and this in the head tag:
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
EDIT: I ended up doing a Struts Filter and simplifying the email addresses to work around this problem (that only showed up when I was in debug, probably due to something in the 3rd party ORM).
Bauke Scholtz wrote:You also need to take the character encoding of the storage/output/display in attention! If you for example did a system.out.println of that value, then the output source (logfile, IDE console, etc) should also use the right charset. If you for example stored it in a database and retrieved it again for display, then the associated database table should also use the right charset.
That would explain why this only happens in debug (I discovered later).
Surya Kant wrote:did you check your application server's encoding.I mean if it is tomcat you can specify in connector element
I ended up adding a J2EE filter to change the response encoding. But I still get gibberish in the text-only fields in my email. There, I had to switch from using the "Inscrutable Name" <firstname.lastname@example.org> format to just using email@example.com format.