Re: Servlet question

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 UTC