JSP charset problem with ISO-8859-7 (Greek) using post via XMLHttpRequest
843840Jun 18 2010 — edited Jul 30 2011Hello everybody.
I am developing web applications in Greek. I have an MVC model. A JSP page (jsp1) posts a form using XMLHttpRequest object to a servlet. The javascript code iterates through the elements of the for and makes a string like:
FIRST_NAME=Arthur&LAST_NAME=Myller...
but in Greek names and characters. This sting is put to the body of the XMLHttpRequest and then gets posted to a servlet.
Then the servlet takes it and does some database inserts and updates and then the request from the XMLHttpRequest object, is forwarded as it is to another jsp page (ssp2) to show the results on the screen.
Finally the html that is produced from jsp2 is returned to the XMLHttpRequest object and put to a div element on jsp1 using div1.innerHTML = [jsp2 html contents].
The problem is that The Greek characters on jsp2 that came from jsp1 are shown like ??????.
both jsp1 and jsp2 pages have a directive
<%@ page language="java" contentType="text/html pageEncoding="ISO-8859-7"%>
Withput pageEncoding="ISO-8859-7" the hardcoded Greek labels cannot be shown.
I have tried request.setCharacterEncoding("ISO-8859-7"); on all three (jsp1, servlet and jsp2) but it doesn't work.
Any ideas? I am really stuck here.
Thanx in advance