Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JSP charset problem with ISO-8859-7 (Greek) using post via XMLHttpRequest

843840Jun 18 2010 — edited Jul 30 2011
Hello 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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 27 2011
Added on Jun 18 2010
6 comments
1,113 views