mirror of https://github.com/M66B/FairEmail.git
Improved header encoding fixing
This commit is contained in:
parent
4d82a6c751
commit
b52c3171c4
|
@ -1207,13 +1207,17 @@ public class MessageHelper {
|
||||||
if (header.trim().startsWith("=?"))
|
if (header.trim().startsWith("=?"))
|
||||||
return header;
|
return header;
|
||||||
|
|
||||||
if (CharsetHelper.isUTF8(header)) {
|
Charset detected = CharsetHelper.detect(header);
|
||||||
Log.i("Converting " + name + " to UTF-8");
|
if (detected == null && CharsetHelper.isUTF8(header))
|
||||||
return new String(header.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8);
|
detected = StandardCharsets.UTF_8;
|
||||||
} else {
|
if (detected == null ||
|
||||||
Log.i("Converting " + name + " to ISO8859-1");
|
CHARSET16.contains(detected) ||
|
||||||
return new String(header.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.ISO_8859_1);
|
StandardCharsets.US_ASCII.equals(detected) ||
|
||||||
}
|
StandardCharsets.ISO_8859_1.equals(detected))
|
||||||
|
return header;
|
||||||
|
|
||||||
|
Log.i("Converting " + name + " to " + detected);
|
||||||
|
return new String(header.getBytes(StandardCharsets.ISO_8859_1), detected);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Address[] getAddressHeader(String name) throws MessagingException {
|
private Address[] getAddressHeader(String name) throws MessagingException {
|
||||||
|
|
Loading…
Reference in New Issue