Unable to change charset from ISO-8859-1 to UTF-8 in glassfish 3.1

The -Dfile.encoding is a Oracle JVM specific setting as to how to read Java source files. This doesn’t have any influence on the charset as specified in the Content-Type header of the HTTP response.

You need to add the following to your web.xml in order to send the response of all JSPs as UTF-8 and to let it set the appropriate charset in the response header.

<jsp-config>
    <jsp-property-group>
        <url-pattern>*.jsp</url-pattern>
        <page-encoding>UTF-8</page-encoding>
    </jsp-property-group>
</jsp-config>

See also:

Leave a Comment