I now have the best solution. Both posts and get the job EXCELLENT. I am working on tomcat, which by default processes ISO 8859 data.
Webpage Properties:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
webpage encoding inside the head.
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
Now all my parameters are escaped using the escape function, I provided this solution earlier.
(function($) {$.fn.escape = function() { return escape(this.val());};})(jQuery);
Now, by sending an ajax request, I set the contentType for this:
contentType : "application/x-www-form-urlencoded; charset=iso-8859-1"
And finally, when getting parameters in a servlet or any receiver, I get a decoded parameter using this.
public String getHttpParameter(String name) throws Exception { String value = this.getHttpRequest().getParameter(name); return value == null || value.isEmpty() ? value : URLDecoder.decode(value,"ISO-8859-1"); }
POST and GET work fine in IE 7 and 8, SAFARI, CHROME and FIREFOX.
Rodrigo Asensio Aug 04 '09 at 17:58 2009-08-04 17:58
source share