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

Re: Servlet question

From: Thierry Sourbier <webmaster@i18ngurus.com>
Date: Fri, 19 Oct 2001 07:36:33 +0200
Message-ID: <003901c15860$07982240$4fadfea9@dell400>
To: <www-international@w3.org>
Souravm,

For parameter reading, the API 2.3 introduces a new method:
request.setCharacterEncoding(Encoding) that let you specfy the character
encoding used to encode parameters in a request. If your servlet
inplementation does not yet support this API then you'll probably have to do
the data convertion *by hand* by first converting your params back to a byte
stream using the system default encoding then decode the byte stream using
the proper encoding. (that's roughly 2 extra lines of code).

For the output, any JSP intended to return data in a character encoding
other than the default (ISO-8859-1 Latin) should contain a content-type
directive near the beginning of the file, in the following form:

<%@ page contentType ="text/html; charset=characterSet" %>

Note that you can also do this by setting the content type header manually,
using
response.setContentType() as Shigemichi hinted. Note that both those option
will normally directly generate the proper HTTP header suppressing somewhat
the need for the Meta Tag.


Cheers,
Thierry

<><><><><><><><><><><><><><><><><><><><><><>
www.i18ngurus.com - Open Internationalization Resources Directory
Received on Friday, 19 October 2001 02:01:51 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 2 June 2009 19:16:58 GMT