users@glassfish.java.net

Content-type mismatch: how to fix?

From: <glassfish_at_javadesktop.org>
Date: Wed, 11 Nov 2009 07:30:31 PST

Hello; I have a .war file deployed to Glassfish 2.1 (a stock installation). I'm having character set issues, despite using charset=UTF-8 everywhere I'm supposed to. The details follow.

The .war file uses the Stripes framework, in case it matters.

The .jsp files all have <%@ page contentType="text/html;charset=UTF-8" language="java" %> directives on them, as well as <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> in the head element.

The database is MySQL 5.0.67. The tables are set to utf8 correctly. Data is properly encoded in the tables.

The driver is Connector/J 5.1.10. It has the useUnicode=true and characterEncoding=UTF-8 properties set on its connection string.

Despite all this, Glassfish is sending a Content-Type header that uses the ISO-8859-1 character set. I don't know why, and in my view this is very wrong.

How do I tell Glassfish to get out of the way and let my application dictate its own character sets?

Thanks,
Laird
[Message sent by forum member 'ljnelson' (ljnelson_at_gmail.com)]

http://forums.java.net/jive/thread.jspa?messageID=371411