Prevent crash

This commit is contained in:
M66B 2019-05-11 12:44:52 +02:00
parent a0b343aa62
commit f4dc6d8c6f
1 changed files with 5 additions and 5 deletions

View File

@ -640,12 +640,12 @@ public class MessageHelper {
return decodeMime(subject);
} else {
// Fix UTF-8 plain header
char[] kars = subject.toCharArray();
byte[] bytes = new byte[kars.length];
for (int i = 0; i < kars.length; i++)
bytes[i] = (byte) kars[i];
try {
char[] kars = subject.toCharArray();
byte[] bytes = new byte[kars.length];
for (int i = 0; i < kars.length; i++)
bytes[i] = (byte) kars[i];
CharsetDecoder cs = StandardCharsets.UTF_8.newDecoder();
cs.decode(ByteBuffer.wrap(bytes));
subject = new String(bytes, StandardCharsets.UTF_8);