Skip to main content
Article

GlassFish Encoding, change Default value

GlassFish's default encoding returns text encoded in ISO 8859 1. This is based on the Hypertext Transfer Protocol HTTP/1.1 RFC 3.7.1 Canonicalization and defaults for text that requires encoding pa

1 min read
galssfishserver
GlassFish Encoding, change Default value

The default GlassFish encoding returns ISO-8859-1 encoded text. This is based on Hypertext Transfer Protocol - HTTP/1.1 RFC 3.7.1 Canonicalization and Text Defaults which requires the default encoding for text to be returned in this manner.

Web application developers often use UTF-8 as an encoding in their applications, but fail to change the server defaults. This applies to anything that uses Servlets (including JSP and JSF). You can change the default values ​​in sun-web.xml or glassfish-web.xml as shown below by setting the parameter encoding element.

<glassfish-web-app>
    <!-- Change the default character encoding from ISO-8859-1 to UTF-8 -->
    <parameter-encoding default-charset="UTF-8"/>
</glassfish-web-app>
glassfich-web.xml file

source: JHON YEARY

ShareXLinkedIn