Hi Andrew, Tomcat list-
I tried setting file.encoding directly on the command-line for launching
tomcat by doing
export CATALINA_OPTS=-Dfile.encoding=iso-8859-1
before I launched the catalina.sh script. The catalina.sh script does:
$JAVA_HOME/bin/java $CATALINA_OPTS -classpath $CP \
-Dcatalina.base=$CATALINA_BASE \
-Dcatalina.home=$CATALINA_HOME \
org.apache.catalina.startup.Bootstrap "$@" start \
>> $CATALINA_BASE/logs/catalina.out 2>&1 &
which seems to me properly will put CATALINA_OPTS onto the java command
line.
Of course, this had no effect, just like every other attempt I've made to
fix this. :) Is "file.encoding" exactly the property that needs to be set?
Will this work?
Thanks!
-Richard
----- Original Message -----
From: "Andrew B. Sudell" <[EMAIL PROTECTED]>
To: "Richard Sand" <[EMAIL PROTECTED]>
Sent: Monday, February 25, 2002 5:48 AM
Subject: changing the default character encoding
> Richard Sand writes:
> > Hi all- Does anyone know how to specify the default encoding for the
JVM in
> > a linux environment?
> >
> > I'm having difficulty with my servlets because the JVM on my system
(sun
> > jdk1.3.1 on linux) is defaulting to us-ascii encoding instead of using
> > iso-8859-1. I know I can override the encoding inside my code, but
> > according to the package description for java.lang, the JVM determines
the
> > default encoding by looking at the OS. I tried setting both LANG and
> > LC_CTYPE in my shell before launching catalina.sh, but I still couldn't
get
> > the servlets to not default to US-ASCII.
> >
>
> Haven't tried this on Linux -- let me know it it dosen't work, I can
> play around with a system at work, that isn't accessible just this
> moment at home -- but in doing some experimentation on different
> versions of Solaris and different JDK versions, the startup logic in
> the JVM went something like
>
> - Examine the C local you are running in
> - Find the character encoding for that locale
> - map that to a Java encoding as best it can (exact scheme seemed to
> vary by JDK release)
> - set file.encoding system property to that
>
> >From there, the Java implementations of String, InputStreamReader, and
> OutputStreamWriter, base their default on file.encoding.
>
> So, try setting the LANG environment variable to someting that dosen't
> use ASCII. Running 'locale -a' gives a list of choices. Something
> like en_US would be a good choice. I expect you have LANG unset, and
> are defaulting to either the POSIX or C locales, which are basically
> the same local and imply ASCII only. Running 'locale' with no
> argument will give you an idea what the system is up to. As you play
> with setting LANG, you may want to write a short java program to print
> the default encoding.
>
> If I remember when I get to work, I'll mail you a java program to
> check the encoding, a C program to get the system charset -- assuming
> it ports to linix quickly -- and a table of example results.
>
> Drew
>
> --
> Drew Sudell [EMAIL PROTECTED] http://www.op.net/~asudell
>
--
To unsubscribe: <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>