Umlaute from JSP-page are misinterpreted
Posted
by
Karin
on Stack Overflow
See other posts from Stack Overflow
or by Karin
Published on 2012-11-08T10:58:22Z
Indexed on
2012/11/08
11:00 UTC
Read the original article
Hit count: 319
I'm getting Input from a JSP page, that can contain Umlaute. (e.g. Ä,Ö,Ü,ä,ö,ü,ß). Whenever an Umlaut is entered in the Input field an incorrect value gets passed on.
e.g.
If an "ä" (UTF-8:U+00E4) gets entered in the input field, the String that is extracted from the argument is "ä" (UTF-8: U+00C3 and U+00A4)
It seems to me as if the UTF-8 hex encoding (which is c3 a4 for an "ä") gets used for the conversion.
How can I retrieved the correct value?
Here are snippets from the current implementation
The JSP-page passes the input value "pk" on to the processing logic:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
...
<input type="text" name="<%=pk.toString()%>" value="<%=value%>" size="70"/>
<button type="submit" title="Edit" value='Save' onclick="action.value='doSave';pk.value='<%=pk.toString()%>'"><img src="icons/run.png"/>Save</button>
The value gets retrieved from args and converted to a string:
UUID pk = UUID.fromString(args.get("pk")); //$NON-NLS-1$
String value = args.get(pk.toString());
Note: Umlaute that are saved in the Database get displayed correctly on the page.
© Stack Overflow or respective owner