wood burning stoves 2.0*
The moose likes Struts and the fly likes unable to handle special characters in struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "unable to handle special characters in struts" Watch "unable to handle special characters in struts" New topic
Author

unable to handle special characters in struts

Thomas vezhamb
Greenhorn

Joined: May 01, 2006
Posts: 3
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

Joined: Feb 15, 2005
Posts: 4864
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.


Merrill
Consultant, Sima Solutions
Thomas vezhamb
Greenhorn

Joined: May 01, 2006
Posts: 3
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: unable to handle special characters in struts