My jsp page has encoding as follows :
<%@ page
contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"
%>
<%
response.setHeader("Cache-control", "no-cache");
response.setHeader("Pragma", "no-cache");
response.setDateHeader("Expires", 0);
response.setCharacterEncoding("utf-8");
response.setContentType("text/html;charset=utf-8");
%>
javascript code printing greek characters well in firebug following is the code :
function save() {
console.log(document.editDistributionListForm.elements['name'].value); //this line prints greek characters
document.editDistributionListForm.elements['subAction'].value='submit';
document.editDistributionListForm.submit();
}
when 'name' value as above is sent to the struts action, the string is not printing greek characters instead it prints ????????????????
Greek Characters entered were : αβγδεζηθ
Struts Bean (Sample code) :
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
Struts Action (Sample code) :
protected ActionForward updateList(ActionMapping mapping,
HttpServletRequest request,
EditListForm form)
throws CannotOverwriteExistingListException, EmptyListException,
ListUpdateException {
log.debug("form.getName :: "+form.getName()); //this line when printed prints (???)
}
when data is sent from html to java i.e. from browser to server the string gets converted from greek to ???? what i am doing wrong. I am not able to identify what i am missing .. .
Please help.
There are no Greek characters in UTF-8.
I think you should reprogram your program to make it print UTF-16 characters (which do include Greek characters). (Change the page encoding from UTF-8 to UTF-16)