<div dir="ltr">Hi,<div><br></div><div>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.</div><div><br></div><div>What I have done is in login.jsp, add the following line:</div>
<div><div><%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%></div><div>That means my response is UTF-8 encoded, and also tells browser to encode in UTF-8 when posting request to server.</div>
<div><br></div><div>But in Shibboleth IdP side, when it retrieves the parameter in UsernamePasswordLoginServlet.java, it doesn't set the correct encoding using:</div><div>request.setCharacterEncoding("UTF-8");</div>
<div><br></div><div>It just call request.getParameter(..), which will decode in default "ISO-885901-1".</div><div><br></div><div>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:</div>
<div>String correctUsername = new String(username.getBytes("iso-8859-1"), "UTF-8");<br></div><div><br></div><div>Changing the UsernamePasswordLoginServlet.java source code is not what I want to do either.</div>
<div><br></div><div>Is there any better way to resolve this? </div><div><br></div><div>Thanks,</div><div>Yaowen</div>
</div></div>