Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JBOSS 7 encoding not working as expected

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

like image 686
Fofole Avatar asked Apr 19 '12 13:04

Fofole


1 Answers

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"
like image 88
vici Avatar answered Sep 19 '22 05:09

vici