aspose file tools*
The moose likes JSP and the fly likes pageEncoding= Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "pageEncoding="UTF-8" in jsp" Watch "pageEncoding="UTF-8" in jsp" New topic
Author

pageEncoding="UTF-8" in jsp

piyuma Mudalige
Greenhorn

Joined: Mar 06, 2009
Posts: 4
Hi,
My problem is ,when <%@page pageEncoding="UTF-8"%> is included in a jsp file labels can be displayed in a whatever language we want.But if we want to submit a value of a text box in the same jsp file and again display the submitted value in a UTF-8 encoded jsp file it is not desplayed in the correct language format.Is there a way to solve this problem?
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9302
    
  17

Hi piyuma, welcome to javaranch.

I didn't understand your question properly, but how did you enter a value of a different language in a text field in a JSP page?? If you are entering normal english characters and are getting a different value as a response, then I'm clueless about this...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9302
    
  17

maybe this could give you some idea...
piyuma Mudalige
Greenhorn

Joined: Mar 06, 2009
Posts: 4
Hi,
thank you , I'll refer the sites given.My problem is this. I have some text boxes in a jsp .<%@page pageEncoding="UTF-8"%> is included in this jsp. I have set the keyboard language to Arabic and when I run the application I'm entering Arabic words as the text box values.I'm saving those values to the database and get the data and trying to display them again in another jsp page.Then they are not displayed in Arabic.Because the data is saved to the database in some unknown format.
But when I remove the <%@page pageEncoding="UTF-8"%> from the jsp file data is saved in a format that i can display them again in a jsp in the correct language format.But then the problem is when <%@page pageEncoding="UTF-8"%> is removed from the jsp file can't display labels of that jsp in Arabic language.For the Arabic labels displaying "??? ".
I want both to display Arabic labels and save Arabic values in the correct format .



Ankit Garg wrote:Hi piyuma, welcome to javaranch.

I didn't understand your question properly, but how did you enter a value of a different language in a text field in a JSP page?? If you are entering normal english characters and are getting a different value as a response, then I'm clueless about this...
Surya Kant
Ranch Hand

Joined: Mar 29, 2005
Posts: 104
Storing the characters in UTF-8 is the standard way.When you read back the values from db,they will be in UTF-8.Your browser is not able understand the UTF-8 characters.
I think you have not set the encoding for your application server.I mean if it is tomcat there is a parameter to set encoding in Connector element.
Let me know in case of any issues
piyuma Mudalige
Greenhorn

Joined: Mar 06, 2009
Posts: 4
thanks, I set the encoding in tomcat.Then the Arabic values entered in jsp are coming to the Action in Arabic format.I put a break point in the Action class and tested.But they are saved into the database as"¿¿¿¿¿¿¿¿¿¿¿¿"


Surya Kant wrote:Storing the characters in UTF-8 is the standard way.When you read back the values from db,they will be in UTF-8.Your browser is not able understand the UTF-8 characters.
I think you have not set the encoding for your application server.I mean if it is tomcat there is a parameter to set encoding in Connector element.
Let me know in case of any issues
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: pageEncoding="UTF-8" in jsp