Describe the bug Saml metadata is corrupted once it contains special characters.

To Reproduce

  1. Configure the metadata to contain special characters, e.g. via OpenSamlMetadataResolver.EntityDescriptorParameters.
  2. Generate the metadata via /saml2/service-provider-metadata/{descriptor}
  3. The metadata is corrupted and invalid xml

Expected behavior The metadata is not corrupted, valid xml and obeys the Saml Standard

Cause In Saml2MetadataFilter Line 111 response.setContentLength(metadata.getMetadata().length()); is generally wrong as the length in bytes is required which differs from Java String length, e.g. "ä".length() = 1 but should be 2