<div dir="ltr">Never mind. <div><br></div><div>Found the solution in wiki:<div><a href="https://wiki.shibboleth.net/confluence/display/SHIB2/IdPAuthUserPass">https://wiki.shibboleth.net/confluence/display/SHIB2/IdPAuthUserPass</a><br>

</div></div><div><br></div><div>Yaowen</div></div><div class="gmail_extra"><br clear="all"><div>Yaowen</div>
<br><br><div class="gmail_quote">On Mon, Nov 25, 2013 at 9:11 PM, Yaowen Tu <span dir="ltr">&lt;<a href="mailto:yaowen.tu@gmail.com" target="_blank">yaowen.tu@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<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>&lt;%@ page contentType=&quot;text/html;charset=UTF-8&quot; pageEncoding=&quot;UTF-8&quot;%&gt;</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&#39;t set the correct encoding using:</div><div>request.setCharacterEncoding(&quot;UTF-8&quot;);</div>


<div><br></div><div>It just call request.getParameter(..), which will decode in default &quot;ISO-885901-1&quot;.</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(&quot;iso-8859-1&quot;), &quot;UTF-8&quot;);<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>
</blockquote></div><br></div>