<style>
/* Changing the layout to use less space for mobiles */
@media screen and (max-device-width: 480px), screen and (-webkit-min-device-pixel-ratio: 2) {
    #email-body { min-width: 30em !important; }
    #email-page { padding: 8px !important; }
    #email-banner { padding: 8px 8px 0 8px !important; }
    #email-avatar { margin: 1px 8px 8px 0 !important; padding: 0 !important; }
    #email-fields { padding: 0 8px 8px 8px !important; }
    #email-gutter { width: 0 !important; }
}
</style>
<div id="email-body">
<table id="email-wrap" align="center" border="0" cellpadding="0" cellspacing="0" style="background-color:#f0f0f0;color:#000000;width:100%;">
    <tr valign="top">
        <td id="email-page" style="padding:16px !important;">
            <table align="center" border="0" cellpadding="0" cellspacing="0" style="background-color:#ffffff;border:1px solid #bbbbbb;color:#000000;width:100%;">
                <tr valign="top">
                    <td bgcolor="#ffffff" style="background-color:#ffffff;color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;line-height:1;"><img src="https://shibboleth.net/images/shib_240x83.png" alt="" style="vertical-align:top;" /></td>
                </tr><tr valign="top">
    <td id="email-banner" style="padding:32px 32px 0 32px;">

                
        
        
            <table align="left" border="0" cellpadding="0" cellspacing="0" width="100%" style="width:100%;">
    <tr valign="top">
        <td style="color:#505050;font-family:Arial,FreeSans,Helvetica,sans-serif;padding:0;">
                                        <img id="email-avatar" src="https://issues.shibboleth.net/jira/secure/useravatar?ownerId=ian%40iay.org.uk&avatarId=10125" alt="" height="48" width="48" border="0" align="left" style="padding:0;margin: 0 16px 16px 0;" />
                        <div id="email-action" style="padding: 0 0 8px 0;font-size:12px;line-height:18px;">
                                    <a class="user-hover" rel="ian@iay.org.uk" id="email_ian@iay.org.uk" href="https://issues.shibboleth.net/jira/secure/ViewProfile.jspa?name=ian%40iay.org.uk" style="color:#326ca6;">Ian Young</a>
     commented on <img src="https://issues.shibboleth.net/jira/images/icons/issuetypes/bug.png" height="16" width="16" border="0" align="absmiddle" alt="Bug"> <a style='color:#326ca6;text-decoration:none;' href='https://issues.shibboleth.net/jira/browse/SIDP-598'>SIDP-598</a>
            </div>
                        <div id="email-summary" style="font-size:16px;line-height:20px;padding:2px 0 16px 0;">
                <a style='color:#326ca6;text-decoration:none;' href='https://issues.shibboleth.net/jira/browse/SIDP-598'><strong>encoding problem in IdP backup metadata file</strong></a>
            </div>
                    </td>
    </tr>
</table>
    </td>
</tr>
<tr valign="top">
    <td id="email-fields" style="padding:0 32px 32px 32px;">
        <table border="0" cellpadding="0" cellspacing="0" style="padding:0;text-align:left;width:100%;" width="100%">
            <tr valign="top">
                <td id="email-gutter" style="width:64px;white-space:nowrap;"></td>
                <td>
                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
                        <tr valign="top">
    <td colspan="2" style="color:#000000;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:12px;padding:0 0 16px 0;width:100%;">
        <div class="comment-block" style="background-color:#edf5ff;border:1px solid #dddddd;color:#000000;padding:12px;"><p>Additional information from Mathew Ian Eis, with permission:</p>

<p>The issue most recently presented itself during a recent internet outage on our campus, in the form of exceptions in our idp-process.log (truncated for brevity):</p>

<p>---------<br/>
04:34:54.727 - WARN <span class="error">&#91;org.opensaml.saml2.metadata.provider.FileBackedHTTPMetadataProvider:101&#93;</span> - Unable to read metadata from <a href="http://wayf.incommonfederation.org/InCommon/InCommon-metadata.xml" class="external-link">http://wayf.incommonfederation.org/InCommon/InCommon-metadata.xml</a> attempting to read it from local backup<br/>
java.net.UnknownHostException: wayf.incommonfederation.org</p>

<p>04:34:54.773 - ERROR <span class="error">&#91;org.opensaml.saml2.metadata.provider.HTTPMetadataProvider:253&#93;</span> - Unable to unmarshall metadata<br/>
org.opensaml.xml.io.UnmarshallingException: org.opensaml.xml.parse.XMLParserException: Invalid XML<br/>
        at org.opensaml.saml2.metadata.provider.AbstractMetadataProvider.unmarshallMetadata(AbstractMetadataProvider.java:190) <span class="error">&#91;opensaml-2.3.1.jar:na&#93;</span><br/>
        ...<br/>
Caused by: org.opensaml.xml.parse.XMLParserException: Invalid XML<br/>
        at org.opensaml.xml.parse.BasicParserPool.parse(BasicParserPool.java:219) <span class="error">&#91;xmltooling-1.2.1.jar:na&#93;</span><br/>
        ...<br/>
Caused by: org.xml.sax.SAXParseException: Invalid byte 1 of 1-byte UTF-8 sequence.<br/>
        at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) <span class="error">&#91;na:na&#93;</span><br/>
        …<br/>
---------</p>

<p>The file was not modified other than might have been done by the IDP itself during normal processing. I did not include the full output of xmllint in original, which does include the “no DTD” error, but is of course unrelated to the UTF error. Here is the full output, in addition to the output of --version:  ( I have since made a copy of the apparently corrupted metadata file, in case the issue is resolved by a fix upstream ).</p>

<p>---------</p>
<ol>
        <li>xmllint --version<br/>
xmllint: using libxml version 20626<br/>
   compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 FTP HTTP DTDValid HTML Legacy C14N Catalog XPath XPointer XInclude Iconv ISO8859X Unicode Regexps Automata Expr Schemas Schematron Modules Debug </li>
</ol>


<ol>
        <li>xmllint --valid --noout InCommon-metadata.xml.2013-12-11_11-26-MST<br/>
InCommon-metadata.xml.2013-12-11_11-26-MST:1: validity error : Validation failed: no DTD found !<br/>
eth-metadata-1.0.xsd <a href="http://www.w3.org/2000/09/xmldsig#" class="external-link">http://www.w3.org/2000/09/xmldsig#</a> xmldsig-core-schema.xsd"<br/>
                                                                               ^<br/>
InCommon-metadata.xml.2013-12-11_11-26-MST:15577: parser error : Input is not proper UTF-8, indicate encoding !<br/>
Bytes: 0xB9 0x73 0x20 0x70<br/>
amespace" xml:lang="en"&gt;The University of Maryland, Baltimore (UMB) is the State<br/>
---------</li>
</ol>


<p>Our production environment is using Shibboleth IDP 2.1.5, and JAVA 1.6.0_24.</p>

<p>Curiously, I just noticed that the issue does not seem to present itself in our test environment, which is using a newer Shibboleth IDP 2.4.0 and JAVA 1.6.0_45.  This would seem to imply that something in the older IDP/JAVA is corrupting the Metadata as it is written down to disk.</p>

<p>I would also add that your theory about the 0xC2 being dropped is correct:</p>

<p>Hex of a file retrieved with wget:<br/>
4d 42 29 20 69 73 20 74 68 65 20 53 74 61 74 65 c2 b9 73 20 70 75 62 6c 69 63 20 68 65 61 6c 74 |MB) is the State¹s public healt|</p>

<p>Hex of the file as stored by the IDP 2.1.5 / JAVA 1.6.0_24:<br/>
4d 42 29 20 69 73 20 74 68 65 20 53 74 61 74 65 b9 73 20 70 75 62 6c 69 63 20 68 65 61 6c 74 |MB) is the State?s public healt|</p>
</div>
        <div style="color:#505050;padding:4px 0 0 0;">                </div>
    </td>
</tr>
                    </table>
                </td>
            </tr>
        </table>
    </td>
</tr>













            </table>
        </td><!-- End #email-page -->
    </tr>
    <tr valign="top">
        <td style="color:#505050;font-family:Arial,FreeSans,Helvetica,sans-serif;font-size:10px;line-height:14px;padding: 0 16px 16px 16px;text-align:center;">
            This message is automatically generated by JIRA.<br />
            If you think it was sent incorrectly, please contact your JIRA administrators<br />
            For more information on JIRA, see: <a style='color:#326ca6;' href='http://www.atlassian.com/software/jira'>http://www.atlassian.com/software/jira</a>
        </td>
    </tr>
</table><!-- End #email-wrap -->
</div><!-- End #email-body -->