Hi Markus,

No, that's not it.  I see my servlet responses fine.  The issue is that when
my servlets do logging, i.e. they open an output stream and write to it, or
when they update my database, the data that gets written is us-ascii.

When I receive a parameter in a JSP page, i.e.

<% String param = request.getParameter("someparam"); %>

and then later write the param to the output, such as

You entered: <%=param%>

I correctly see what I entered, including western europe characters.

But when I write the string to a log file or a JDBC connection from within
the page, it comes out as us-ascii with '?' for the characters.  The reason
this happens is that the *default* encoding is us-ascii instead of
iso-8859-1.

So again, according to the package description for java.lang, the JVM
determines the default encoding by looking at the OS environment.  On my
development machine (win2k), all of my code functions properly because the
machine, the environment is set to a european locale.  So my question is:

What settings are necessary (shell environment, others?) on Linux to get the
JVM (sun jdk131) to use iso8859-1 as default instead of us-ascii??

Thanks for your help!

Best regards,

Richard

----- Original Message -----
From: "Markus Spath" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Monday, February 25, 2002 6:30 AM
Subject: Re: changing the default character encoding


> 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]>
>
>


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to