[2.9] Backport of NEXUS-6622 Unknown charset

Original PR
https://github.com/sonatype/nexus-oss/pull/554

Issue
https://issues.sonatype.org/browse/NEXUS-6622