zuban wrote:
how do I decode a request parameter?
like this on:
/.../EditUser.do?id=g%C3%BCltz
the value should be: "gültz"
in my Action-Class I do the following:
-----------------------------
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws
Exception {
String username = request.getParameter("id");
username = new String(username.getBytes(request.getCharacterEncoding()),
request.getCharacterEncoding());
....
---------------------------
But after that username equals "gültz" instead "gültz" ?
[Asside: new String(str.getBytes(C), C) is a redundant construct; you're
telling the JVM to convert the internal representation of a string into
a set of bytes encoded in character set C, and then decode those bytes
back into a string in the original internal format...]
You shouldn't have to do any manual character set conversions if you
have everything configured correctly. Make sure you include the
appropriate page directive and HTML META tag in your JSPs to specify the
character encoding you want to use (UTF-8 recommended) and that you set
the request character encoding before reading any parameters and it
should all 'just work'.
Search the archives for more on i18n / internationalization and
character encoding issues, this is something that comes up quite often.
HTH,
L.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]