7

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

Fofole
  • 3,398
  • 8
  • 38
  • 59

3 Answers3

10

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"
vici
  • 326
  • 3
  • 4
7

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)

Brian Agnew
  • 268,207
  • 37
  • 334
  • 440
  • This is the thing I found all kinds of solutions that work on other JBoss versions but none worked for me in JBoss 7 +1 for trying to help. – Fofole Apr 19 '12 at 13:16
  • 1
    Where did you try it though? You might need to place it in the standalone.conf (or domain.conf depending on which one you're running) in the JAVA_OPTS. – James R. Perkins Apr 19 '12 at 15:58
  • As @JamesR.Perkins says, you can put it into the *.conf file, which controls the JVM runtime parameters. You can also pass these values at startup from the command line. – davidryan Apr 24 '12 at 03:03
  • 1
    This works also on JBoss 7.1 the config file is now $JBOSS_HOME/bin/standalone.conf – stacker May 22 '14 at 08:36
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" />
Toon Krijthe
  • 52,876
  • 38
  • 145
  • 202
shasho
  • 131
  • 2
  • 13