<p dir="ltr">I'm using Shibboleth to authenticate via SAML. </p>
<p dir="ltr">Shibboleth sends some assertions, via Apache, to my app running behind Tomcat 8.</p>
<p dir="ltr">Tomcat is configured to use AJP 1.3 for communication.</p>
<p dir="ltr">The problem is the UTF-8 data is corrupted once it comes off the AJP port. </p>
<p dir="ltr">I have debugged into the Tomcat AJP classes and see the bytes are correct. They arrive in an object called ByteChunk and are then converted to a String and the charset is ISO-8859-1.</p>
<p dir="ltr">The String is incorrect.</p>
<p dir="ltr">ISO-8859-1 is the default used by ByteChunk and I've verified it is not reset/changed to UTF-8 despite having specified it in server.xml per Tomcat documentation.</p>
<p dir="ltr">I found this:</p>
<p dir="ltr"><a href="https://issues.shibboleth.net/jira/browse/SSPCPP-2">https://issues.shibboleth.net/jira/browse/SSPCPP-2</a></p>
<p dir="ltr">which says this problem has been around since at least 2007</p>
<p dir="ltr">Then I found this:</p>
<p dir="ltr"><a href="https://wiki.shibboleth.net/confluence/plugins/servlet/mobile#content/view/4358180">https://wiki.shibboleth.net/confluence/plugins/servlet/mobile#content/view/4358180</a></p>
<p dir="ltr">which suggests the following solution:</p>
<p dir="ltr">String value= request.getHeader("givenName"); <br>
value= new String( value.getBytes("ISO-8859-1"), "UTF-8");</p>
<p dir="ltr">I have to get my data via request.getAttribute("key")</p>
<p dir="ltr">Is the solution appropriate for data delivered as attributes?<br>
</p>