This will happen when the data which is initially decoded using UTF-8
has been incorrectly encoded using ISO-8859-1
. You can easily reproduce this by:
String input1 = new String("äöü");
System.out.println(input1); // äöü
String input2 = new String(input1.getBytes("UTF-8"), "ISO-8859-1");
System.out.println(input2); // äöü
String input3 = new String(input2.getBytes("UTF-8"), "ISO-8859-1");
System.out.println(input3); // äöü
(note that the last one actually contains more characters, but SO's message parser ate them).
This means that somewhere in your webapp ISO-8859-1
was incorrectly been used instead of UTF-8
. It's hard to pinpoint the root cause with the as far given information. You can try to sysout the request parameters in the JSF bean action method and read the output in stdout (you only need to ensure that the stdout is using UTF-8
as well! if you're using an IDE like Eclispe, you can configure that in Workspace preferences). If those chars looks garbage as well, then it's the request encoding which is wrong. If those chars looks fine, then it's the response or webbrowser encoding which is wrong. To exclude the webbrowser from being suspect, then you can in e.g. Firefox determine the encoding used by View > Character Encoding.