0

I have one stutrs project. In the JSP page user can put any language data like english/japanese/latin etc. I have put <%@page contentType="text/html;charset=UTF-8"%> in JSP page so when the user is putting the value in the text box it is showing properly or if the data is coming from database it is showing properly in the page.

But during save the data getting corrupted(I can see it in debug mode as well in the DB). I have put request.setCharacterEncoding("UTF-8"); in the action layer but still no joy.

How to solve the problem.

Please help.

Sailajoy Das
  • 25
  • 1
  • 6

1 Answers1

0

You must set the character encoding in your <form> element so the browser knows what your server expects.

This question explains how to do that: Setting the character encoding in form submit for Internet Explorer

Community
  • 1
  • 1
Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820
  • Thank you very much for the response. But I am failing to identify the right answer among them. – Sailajoy Das Feb 13 '13 at 13:19
  • I have tomact server version 5.5. Has it anything to do with this? – Sailajoy Das Feb 13 '13 at 13:21
  • Just add `accept-charset="..."` to the `form` element and the mentioned workarounds if you use IE. Tomcat has nothing to do with it (except that you shouldn't use such old software unless security is absolutely irrelevant to you). – Aaron Digulla Feb 13 '13 at 14:00
  • I have already put accept-charset="UTF-8" in the form but no joy. – Sailajoy Das Feb 14 '13 at 05:13
  • IE has bugs; that's why you need to read the answers I linked above. They tell you how to set the character encoding of FORM data in IE. – Aaron Digulla Feb 14 '13 at 15:00