File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

pageEncoding="UTF-8" in jsp

 
piyuma Mudalige
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9497
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Ankit Garg
Sheriff
Posts: 9497
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
maybe this could give you some idea...
 
piyuma Mudalige
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 104
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic