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? 

Regards,
Nisha.


-----Original Message-----
From: listdad@webstandardsgroup.org
[mailto:[EMAIL PROTECTED] On Behalf Of Lachlan Hunt
Sent: Friday, February 23, 2007 6:11 AM
To: wsg@webstandardsgroup.org
Subject: Re: [WSG] Internationalization for hindi (data getting
corrupted while sendng from jsp to action)

On Feb 22, 2007, at 4:53 AM, Nisha Kumari wrote:
> I am trying to implement internationalization for my site. But when I
am
> trying to enter some Hindi text in a text box (struts html:text) the
> value I m getting in my action is not expected one. Getting some
> corrupted value rather than Hindi entered text.
>
> I have set charset to utf-8 in the jsp page. Do I need to do any thing
> more?

This is a little off topic for this list, but you need to check that you

have handled all the encoding issues correctly.  You need to declare 
both the encoding of the actual JSP file and the encoding served to 
browsers.  Unfortunately, JSP defaults to ISO-8859-1 instead of UTF-8, 
but it's relatively easy to handle using the @page directive at the top 
of every JSP file.

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

The encoding attribute specifies the actual encoding of the file (you 
need to ensure your editor is actually saving in UTF-8).  The 
contentType attribute specifies the HTTP Content-Type header to be sent 
to UAs.  If the  2 declared encodings differ, then JSP will transcode it

before sending.

Ideally, there should be a way to set these as defaults in web.xml for 
the application server, but I've never successfully found a way to do
it.

You should then verify that the document received by browses is actually

encoded in UTF-8.  If you've done the above correctly, it will be, but 
check anyway.

Browsers will submit form data in the same encoding as the page.  So 
unless the user explicitly changes it from UTF-8, then it will be UTF-8.

  Finally, you need to make sure your form processing on the server side

is actually accepting and interpreting the form submission as UTF-8.  It

should do so if you added the @page directive correctly.

-- 
Lachlan Hunt
http://lachy.id.au/


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




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

Reply via email to