Assuming you're talking about a JSP (and not a static HTML page), try doing this at 
the top of your JSP file:

<[EMAIL PROTECTED] contentType="text/html; charset=UTF-8"%>

Or

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

(these are equivalent, if memory serves me correctly).

I've always been a little unsure as to how the browsers handle differences in the HTTP 
header and HTTP-EQUIV, but I guess your example shows that it's using the HTTP header 
(the default is ISO-8859-1).  Althought, it might be browser-dependent.  I always just 
make sure they match.

Another thing to look out for...if you're handling posted form data, make sure you 
call request.setCharacterEncoding("UTF-8") before doing the request.getParameter 
calls.  There might be other ways to handle this, depending on your servlet container. 
 I think Tomcat requires the call to request.setCharacterEncoding, but I know that 
iPlanet 6 doesn't support that call.  For iPlanet 6, you have change a configuration 
file to tell it you want posted data to be interpreted as UTF-8.  This is legacy HTTP 
stuff...there's no standard way for a POST to contain the character set of the data 
(the web application just has to know).

Allen

> -----Original Message-----
> From: Chaitanya Pallapothula [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, September 03, 2003 8:56 PM
> To: [EMAIL PROTECTED]
> Subject: Internationalization Problem
> 
> 
> Hi 
> I have been working on Internationalization and during
> that process I encountere this strange problem. 
> My server is sending the right characters(Russian) to
> the browser. And also I have put this tag "<META
> HTTP-EQUIV="Content-Type"
> CONTENT="text/html;charset=utf-8">" in the head pasrt
> of my out put. 
> 
> The problem is browser cannot render the characters
> correctly. And when I see the view -> Encoding menu of
> the browser "Western Europian(Windows)" was selected.
> If I manually change that to UTF-8 it paints the
> correct characters. 
> 
> So I added the code(socument.chatset="utf-8") to force
> the browser to select UTF-8 as encoding. This time the
> encoidng was selected as UTF-8 and still the browser
> doesnt paint the characters correctly. If I click on
> view->Encoding->UTF-8 manually(Though utf-8 is
> selected by default). It paints the characters
> correctly. 
> 
> I am confused with this kind of behaviour. I am using
> tomcat4.1.12 as my servlet engine and web server. And
> also I am using struts framework(tag lib also). 
> 
> Note:  When I set the charset in the response. The
> server doesnt send the right characters to the
> browser. If I dont set any charset in the response
> header, server sends the right charset to the browser.
> 
> 
>  I am also confused whether the problem is browser or
> the server.
> 
> Any help would be greatly apreciated. 
> Thanks
> Chaitanya
> 
> 
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

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

Reply via email to