mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-31 06:08:31 +02:00
Workaround wrongly encoded headers
This commit is contained in:
@@ -34,6 +34,7 @@ import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
@@ -475,7 +476,22 @@ public class MessageHelper {
|
||||
return null;
|
||||
|
||||
header = new String(header.getBytes(StandardCharsets.ISO_8859_1));
|
||||
return InternetAddress.parseHeader(header, false);
|
||||
Address[] addresses = InternetAddress.parseHeader(header, false);
|
||||
|
||||
for (Address address : addresses) {
|
||||
InternetAddress iaddress = (InternetAddress) address;
|
||||
iaddress.setAddress(decodeMime(iaddress.getAddress()));
|
||||
String personal = iaddress.getPersonal();
|
||||
if (personal != null) {
|
||||
try {
|
||||
iaddress.setPersonal(decodeMime(personal));
|
||||
} catch (UnsupportedEncodingException ex) {
|
||||
Log.w(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return addresses;
|
||||
}
|
||||
|
||||
Address[] getFrom() throws MessagingException {
|
||||
|
||||
Reference in New Issue
Block a user