I'm using JSP on a Apache Tomcat 7.0.41 and want to transfer Form-Data to another page.
For some reasons the German "Umlaute" work if I use GET, but don't if I use POST. Examples:
@€ --> @â¬
äöüß --> äöüÃ
Österreich --> Ãsterreich
So I wrote a small Script which uses the recommended encodeURIComponent()
-JS-Function:
function onsubmitfu() {
tas = document.getElementsByTagName('textarea');
for (index = 0; index < tas.length; index++) {
tas[index].innerHTML = encodeURIComponent()(tas[index].innerHTML);
}
tas = document.getElementsByTagName('input');
for (index = 0; index < tas.length; index++) {
tas[index].value = encodeURIComponent(tas[index].value);
}
}
And well, it "changes"...
äöü߀ --> äöüÃâ¬
Some sources on the Internet prefer escape()
so I gave it a try and it works how it is supposed to work but on the wrong side... Now the JSP-Page receives:
äöü߀ --> %E4%F6%FC%DF%u20AC
This looks how it would be supposed to look in the URL I guess...
Both pages use
<%@page contentType="text/html" pageEncoding="UTF-8"%>
Yet I don't understand why there are differences in the behavior of these two variants. Is there a workaround?