How to handle non-ASCII Username
Yaowen Tu
yaowen.tu at gmail.com
Tue Nov 26 00:23:13 EST 2013
Never mind.
Found the solution in wiki:
https://wiki.shibboleth.net/confluence/display/SHIB2/IdPAuthUserPass
Yaowen
Yaowen
On Mon, Nov 25, 2013 at 9:11 PM, Yaowen Tu <yaowen.tu at gmail.com> wrote:
> Hi,
>
> I am using Username Password login handler. But if the username contain
> non-ASCII characters it will fail. Somehow the encoding messed up the
> string.
>
> What I have done is in login.jsp, add the following line:
> <%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
> That means my response is UTF-8 encoded, and also tells browser to encode
> in UTF-8 when posting request to server.
>
> But in Shibboleth IdP side, when it retrieves the parameter in
> UsernamePasswordLoginServlet.java, it doesn't set the correct encoding
> using:
> request.setCharacterEncoding("UTF-8");
>
> It just call request.getParameter(..), which will decode in default
> "ISO-885901-1".
>
> Then when my JAAS module gets the username it is already messed up. I have
> to manually convert the string to UTF-8 manually like:
> String correctUsername = new String(username.getBytes("iso-8859-1"),
> "UTF-8");
>
> Changing the UsernamePasswordLoginServlet.java source code is not what I
> want to do either.
>
> Is there any better way to resolve this?
>
> Thanks,
> Yaowen
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://shibboleth.net/pipermail/users/attachments/20131125/5c79bcd2/attachment.html
More information about the users
mailing list