views:

374

answers:

2

I'm running Tomcat6 locally on Mac OS 10.5.8. Our staging and production servers have setup an environment variable of:

LANG=en_US.UTF-8

Stage and production run on CentOS and read this value in when java and Tomcat starts up. However, it doesn't appear that java is reading this value and is defaulting to en_US_ISO_85591. On my local machine, I have added LANG=en_US.UTF-8 to my .bash_profile file, because java & Tomcat are running as my user.

If it helps, the situation we're running into is that we have a backend service that delivers xml-formatted UTF8 data to another controller that converts the data into a page-level variable. Its during the conversion process locally that the XML data is being converted to the ISO_85591 format, then back to UTF-8, and it breaks with this error:

Invalid byte 1 of 1-byte UTF-8 sequence.

Is there another way to configure this?

A: 

I suggest you to read Running Tomcat on Macintosh OS X and Installing Apache Tomcat on Mac OS X, in these tutorials you will found how to solve your problem.

Nathan Campos
Links are helpful. RTFM attitude, not so much.
toolbear74
+2  A: 

You can set file encoding for tomcat in CATALINA_OPTS environment variable:

cd <tomcat_root>
CATALINA_OPTS="-Dfile.encoding=UTF-8"./bin/startup.sh
stask