Chinese characters garbled on Jboss web application

On my personal Mac I could see Chinese characters rendered correctly on Web Page

But when the application is deployed on a server it was showing garbled chars like below

garbled chinese characters on jboss web app.png

In my case.. my server provider had done some recent security upgrade. So my production web app was displaying chinese characters before the upgrade.

In any case, the responsibility was with me to fix this issue permanently

The solution was to add the below utf8 encoding params to Jboss startup script : run.conf

JAVA_OPTS=”$JAVA_OPTS -Dfile.encoding=utf-8 -Dsun.jnu.encoding=utf-8″

Once I restarted my production jboss with the above settings the application displayed chinese characters correctly!

Tested on jboss version 5.1.0

Courtesy: https://jira.exoplatform.org/browse/PLF-5646

Note:  THis tip is only for java applications running on top of Jboss. I haven’t figured out how to display chinese characters in jboss logs and mysql client

Leave a comment