All,
I got a report of a user on our development system at $work saying that
special characters were being mangled. We are using Tomcat 8.5 with a
custom web application and MariaDB under the hood. We are expecting to
use UTF-8 everywhere and I can confirm that our testing environment and
production environments do *not* have this problem.
I've written a tiny JSP to demonstrate the problem.
charecho.jsp
==== CUT ====
<%
response.setContentType("text/html");
response.setCharacterEncoding("UTF-8");
%><html>
<head>
<meta http-equiv="Content-Type" content="text/html; UTF-8" />
<meta charset="UTF-8" />
</head>
<body>
<form method="post" accept-charset="UTF-8">
<textarea name="text"><%= (null != request.getParameter("text") ?
request.getParameter("text") : "")%></textarea>
<input type="submit" />
</form>
</body>
</html>
==== CUT ====
I tried this on my development and testing environments and it behaves
properly in my testing environment running 8.5.53, but not on my
development environment running 8.5.64.
So I got myself a fresh copy of both 8.5.53 and 8.5.64 and put this JSP
into the ROOT web application and it didn't work as expected.
Just enter either or both of these multi-byte Unicode characters into
the text area and submit the form. You'll get mangled characters showing
up which, if you submit many times, will multiple over and over again.
†
😈
Our custom application does have a "character encoding filter" in-place
which sets the request character encoding to "UTF-8" if it's null (which
is very common) which is the only thing I can think of that's not quite
similar to an out-of-the-box configuration for Tomcat.
I'm in the process of checking *everything*. But I'm hoping someone can
(a) explain why the above JSP doesn't behave as expected on an
out-of-the-box Tomcat and (b) what I might be overlooking, especially
since this has been working for us for many years without any problems
until somewhat recently.
Thanks,
-chris
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org