I have an application in Java EE and I have my database in ISO-8859-1, thus I need do the jsp encoding in ISO-8859-1... (all my pages are in iso-8859-1)
I have a jsp with a javascript code, which does a request to a Struts action.
This is my js code.
$.ajax({
type:'GET',
encoding:'iso-8859-1',
contentType: 'text/html;charset=ISO-8859-1',
url: xUrl,
success: function(){
$("#MensajeOk").attr('style','display:block');
$("#MensajeOk").delay(10000).slideUp(1000);
}
});
with IE and Chrome all is correct, because it does the request coding in ISO-8859-1 but Firefox encodes the request in UTF-8 and this is a problem for me, because in server side I need ISO-8859-1 and with FF there are some characters than i can't recover.
mi form is
<html:form action="/action.do" acceptCharset="iso-8859-1">
<input type="text" name="title">
and my java code is
new String((request.getParameter("title")+"").getBytes("iso-8859-1"),"iso-8859-1"));
with it, I can recover fine the text with IE and Chome, but fails with Firefox.
Other option will be send the request in UTF-8 encoding by encodeURI('data') but in the server side I can't convert the text from UTF-8 to ISO-8859-1...
Some idea???
Thanks a lot and sorry for me english!!