On 23 Feb 2007, at 06:55:01, Nisha Kumari wrote:

Hi

I have done all following changes in my jsp page. I am using struts and
even have saved my Hindi text in a application recourse file and have
save that file in a UTF-8 encoding format.

I can see in browser the encoding is getting set to UTF-8 because of the
jsp tag (<[EMAIL PROTECTED] encoding="UTF-8"
contentType="text/html;charset=UTF-8"%>).

But still its showing me something other than Hindi (may be garbag). I
tried commenting out the page encoding from jsp page and then I
explicitly changed the page encoding from browser then the text appears
perfectly in Hindi.

What could be the reason?

As manually changing the encoding in the browser shows the Hindi correctly, you are obviously sending the correct data, so that's not the problem.

When the browser attempts to identify the character set of the document, it looks first for a Content-Type HTTP header, and only if that isn't found does it look for a <meta> element specifying the character set - see [1]. I don't know Struts, but a look at the JSP documentation suggests that you should be using "pageEncoding" instead of "encoding" in your @page directive. [2] I don't know if this affects the Content-Type header, or just creates a <meta> element, though.

If changing that doesn't work, then I would suggest looking at the raw HTTP headers for your page, to see if the Content-Type header is correctly specifying UTF-8. If you use Firefox, there are various ways to do this via extensions such as Firebug, although going to Tools menu->Page Info may tell you what you need to know. Assuming you're using Microsoft Windows, a free application called Fiddler, written by a chap at Microsoft, will allow you to examine the raw HTTP traffic between your browser and your server [3]. If it turns out that the Content-Type header in the HTTP response is overriding any Meta element in the document, then you need to change your server configuration; at that point, my lack of knowledge of your configuration leaves me unable to help any further :-(

[1] <http://www.w3.org/TR/html4/charset.html#h-5.2.2>
[2] <http://java.sun.com/products/jsp/syntax/1.2/ syntaxref1210.html#15653>
[3] <http://www.fiddlertool.com/fiddler/>

HTH,

Nick.
--
Nick Fitzsimons
http://www.nickfitz.co.uk/





*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
*******************************************************************

Reply via email to