Richard,
Richard Sand wrote:
> 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.
i guess you want to set the encoding of your servlets response.
you can do this, calling the setContentType() method of the
(Http)ServletResponse object - before getting a Writer or Stream.
...
public void doGet(HttpServletRequest request, HttpServletResponse response) {
response.setContentType("text/html; charset=ISO-8859-1");
PrintWriter blabla = response.getWriter();
....
}
regards,
Markus
--
To unsubscribe: <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>