Pages

Monday, January 25, 2010

JBoss - Encoding UTF-8 lost in application with EJB3

While developping a web application using EJB3 and JBoss, I've got a strange issue. The database (PostgreSQL) was in UTF-8, and the front end was also specifying UTF-8. But when I retrieve french characters with accents, they aren't showed correctly. It seems they are broken with ISO 8859-1 characters between the database and the JPA layer.

In ordrer to resolve the problem, I found that we need to force JBoss to use UTF-8. To do that, open {JBOSS_HOME}/bin/run.conf and add JVM option

-Dfile.encoding=UTF-8

No comments:

Post a Comment