Hello

> I am using Tomcat 5.0 and I am trying to receive and
> send  thai characters. Can someone please tell me the
> simplest ways to do this.


This worked for me with Japanese characters:

Use a filter to set encodings for both requests and responses:


    request.setCharacterEncoding( "UTF-8" );
    response.setContentType( "text/html; charset=UTF-8" );


Specify the following HTML header meta-tag in your JSPs:


    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">


Always specify "UTF-8" as the charset.

Stick to submitting form-data with POST methods.

I have not tried encoding URI's with GET requests. If you must use URI's
with GET requests, try to limit yourself to working with ID-string
parameters, so that you can avoid encoding issues.

NOTE: Calling the 'ServletResponse.setContentType()' method (as above) is
equivalent to calling the following two ServletResponse methods together:


    response.setContentType( "text/html" );
    response.setCharacterEncoding( "UTF-8" );


Browsers should (and mostly do, I think) respect the encoding you specify
when setting the response content-type (and the meta-tag content-type) so
you can simply assume (in your filter) that your form-data will be in UTF-8.

Clients still need to, of course, set their browsers to display the relevant
charsets correctly.

HTH.

Harry Mantheakis
London, UK



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to