The solution works fine by giving
"-Dfile.encoding=ISO8859_1"
>-Dfile.encoding=ISO-8859_1
To make it more simple, I just added an environment variable
TOMCAT_OPTS=-Dfile.encoding=ISO8859_1 and it works.
-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of
Sherbahadur Khurshid
Sent: Friday, December 29, 2000 5:17 PM
To: [EMAIL PROTECTED]
Subject: Re: problem with german umlaute / special characters
Hi,
>can anyone tell me why this configuration workes when it's made in the
>at the base system but works not if made in the servlet?
The reason is that the Locale object has no effect on the charset used
by the Readers and Writers. The Readers and Writers use the System
property "file.encoding" to determine what charset to use (if you are
using the default constructors for the Readers and Writers).
So basically, the following has no effect:
> myLocale = new Locale("de", "DE");
> Locale.setDefault(Locale.GERMANY);
If your provider did not change the "System Environment"
there were still 2 ways for you to correctly read and write
characters in the ISO-8859_1 charset.
1) You could change the settings of the java virtual machine to use
ISO-8859_1
as the file.encoding. You could do this in one of two ways
a) Pass the following parameter to the java virtual machine when it's
called
"-Dfile.encoding=ISO-8859_1"
b) Set the default System encoding to ISO-8859_1 in your java program
by System.setProperty("file.encoding","ISO-8859_1")
This may or may not work depending on the Security Manager settings
2) You could use the Reader and Writer constructors which accept a charset
e.g. FileReader(myfile,"ISO-8859_1") to correctly read and write characters.
Hope this helped.
-Sher
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html