W3C home > Mailing lists > Public > www-international@w3.org > October to December 2001

Re: Servlet question

From: Shigemichi Yazawa <yazawa@globalsight.com>
Date: Thu, 18 Oct 2001 22:20:38 -0600
Message-ID: <871yk0i7l5.wl@globalsight.com>
To: www-international@w3.org
At Fri, 19 Oct 2001 09:28:43 +0530,
souravm <souravm@infy.com> wrote:
> Servlet engine uses platform's default encoding while returning the
> string as a result of getParameter method call. Servlet engine converts
> the bytes based on the platforms's default encoding and creates an
> unicode string. Is there any way one can specify which is the encoding
> to be used instead of default platform's encoding ?

It depends on the servlet implementation. Weblogic allows you to set
the encoding to be used. I'm sure there are other servlet engines that
can do this.

> Same thing is done (i.e., uses platforms's default encoding) when
> servlet engine converts a unicode string to non unicode bytes while
> sending the output to the client, if the charset is sepcified using
> meta-tag instead of setting through the content type. Can the encoding
> to be used be specified someway in this case also ?

Call ServletResponse#setContentType("text/html; charset=your_encoding")
before calling ServletResponse#getWriter().

Shigemichi Yazawa
Received on Friday, 19 October 2001 00:20:53 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 21 September 2016 22:37:21 UTC