Simplify header charset conversion

Thanks @JorgK
This commit is contained in:
M66B 2020-08-29 07:50:10 +02:00
parent 1cd3f84ed6
commit 3728bfd7a5
1 changed files with 3 additions and 7 deletions

View File

@ -1135,16 +1135,12 @@ public class MessageHelper {
return header;
if (Helper.isUTF8(header)) {
if (!Helper.isISO8859(header)) {
Log.w("Converting " + name + " to UTF-8");
return new String(header.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8);
}
Log.w("Converting " + name + " to UTF-8");
return new String(header.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8);
} else {
Log.w("Converting " + name + " to ISO8859-1");
Log.i("Converting " + name + " to ISO8859-1");
return new String(header.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.ISO_8859_1);
}
return header;
}
private Address[] getAddressHeader(String name) throws MessagingException {