Unmappable Character - Wrong Charset

MailArchiva obtains the charset from the OS locale. If the OS locale specifies a charset that is not UTF-8, then the MailArchiva system will observe instability. Errors appear in the debug.log file similar to the one below.


2017-10-24 09:22:32 c.s.a.rn [ERROR] failed to extract text from: {null}Input length = 1
java.nio.charset.UnmappableCharacterException: Input length = 1
at java.nio.charset.CoderResult.throwException(CoderResult.java:282)
at sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:285)
at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:125)
at java.io.OutputStreamWriter.write(OutputStreamWriter.java:207)



The resolution is to add the following to startserver script in /opt/mailarchiva/server/


export JAVA_OPTS="-Dsun.jnu.encoding=UTF-8 -Dfile.encoding=UTF-8"
export LC_ALL
export LC_CTYPE="en_US.UTF-8"


And restart the server.

Was this information helpful?

Found this information useful? Visit mailarchiva.com to learn more about MailArchiva.