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]
*******************************************************************

Reply via email to