JBOSS 7 encoding not working as expected

15,478

Solution 1

for jboss-as-7.1.1.Final i added this line to standalone.conf, this file lives under the directory bin:

JAVA_OPTS="$JAVA_OPTS -Dorg.apache.catalina.connector.URI_ENCODING=UTF-8"

Solution 2

Have you tried setting the default encoding for the JVM ? Set the confusingly named property:

-Dfile.encoding=UTF-8

(for JBoss 5 you'd set this in run.conf. I don't know if this is different for JBoss 7)

Solution 3

For me what solved the problem was adding the following to the components.xml:

 <web:character-encoding-filter encoding="UTF-8"
                    override-client="true"
                    url-pattern="*.seam" />
Share:
15,478
Fofole
Author by

Fofole

Updated on June 21, 2022

Comments

  • Fofole
    Fofole almost 2 years

    I had problems with my listgrids not showing diacritcs corectly and I found out that when I inserted from java into the db the values where already bugged.

    A post here helped and I changed my project properties -> Text encoding -> other -> UTF-8 and this fixed my problem. Thing is this only fixes my problem locally.

    What I need to do is on my Jboss server also set the encoding somehow. This is what I put in my configuration file:

        <?xml version='1.0' encoding='UTF-8'?>
    
    <server name="vali-ubuntu" xmlns="urn:jboss:domain:1.0">
        extensions>
            extension module="org.jboss.as.clustering.infinispan"/>
            extension module="org.jboss.as.connector"/>
            extension module="org.jboss.as.deployment-scanner"/>
            extension module="org.jboss.as.ee"/>
            extension module="org.jboss.as.ejb3"/>
            extension module="org.jboss.as.jaxrs"/>
            extension module="org.jboss.as.jmx"/>
            extension module="org.jboss.as.logging"/>
            extension module="org.jboss.as.naming"/>
            extension module="org.jboss.as.osgi"/>
            extension module="org.jboss.as.remoting"/>
            extension module="org.jboss.as.sar"/>
            extension module="org.jboss.as.security"/>
            extension module="org.jboss.as.threads"/>
            extension module="org.jboss.as.transactions"/>
            extension module="org.jboss.as.web"/>
            extension module="org.jboss.as.weld"/>
        /extensions>
         system-properties>
            property name="org.apache.catalina.connector.URI_ENCODING" value="UTF-8"/>
            property name="org.apache.catalina.connector.USE_BODY_ENCODING_FOR_QUERY_STRING" value="tru
    e"/>
        /system-properties>
    
    //.....
    

    This doesn't work so maybe I need to add something else. I tried everything I could find with no succes so any help is appreciated. Thanks.

    EDIT:From what I read, this will work only in jboss 7.1.0 beta 1 or highier. (URIEncoding) and I use JBoss 7.0.2 so I need a replacement for 7.0.2