Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

unable to handle special characters in struts

 
Thomas vezhamb
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,

we are entering some mexicon values in text box but while printing corresponding form value from the action class(in console), some characters are replaced by question mark.So I am unable to save the expected value in database. For example if we are entering "Operaci�n fall�" in text box but while printing it in console it is printed as "Operaci??n fall??" so the same will be saved in database also.

I think the problem is occuring while struts handling forms.Please suggest me how we can resolve this issue.

Best Regards,
Thomas
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just make sure you set the encoding character set properly and it will work. Something like this:

<%@ page
language="java"
contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1" %>

Don't worry about what shows in a System.out.println(). The question marks don't mean there is anything wrong with the data. As long as when you retrieve the data back from the database it displays properly on the form, that's all that matters.
 
Thomas vezhamb
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry Merryl,
Actually with the value we are getting from the form, we are making a xml file and sending to Oblix for saving in to LDAP. But while we creating xml file with the form bean value the special characters are replaced with question mark. In a nutshell we are unable to send the right value through the xml request. That creates the issue.

I have already done as you suggested, but I think, this is not related to display problem in Jsp.

Regards,
Thomas
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic