mirror of https://github.com/M66B/FairEmail.git
Fixed subject decode workaround
This commit is contained in:
parent
2fa0b0564b
commit
7d697046ce
|
@ -496,15 +496,21 @@ public class MessageHelper {
|
||||||
|
|
||||||
String getSubject() throws MessagingException, UnsupportedEncodingException {
|
String getSubject() throws MessagingException, UnsupportedEncodingException {
|
||||||
String subject = imessage.getSubject();
|
String subject = imessage.getSubject();
|
||||||
if (subject != null && subject.contains("=?")) {
|
if (subject == null)
|
||||||
String prev;
|
return subject;
|
||||||
do {
|
|
||||||
prev = subject;
|
int i = 0;
|
||||||
subject = MimeUtility.decodeText(subject);
|
int s = subject.indexOf("=?", i);
|
||||||
Log.i("Mime decode " + prev + " -> " + subject);
|
int e = subject.indexOf("?=", i);
|
||||||
}
|
while (s >= 0 && e >= 0 && i < subject.length()) {
|
||||||
while (!subject.equals(prev));
|
String decode = subject.substring(s, e + 2);
|
||||||
|
String decoded = MimeUtility.decodeText(decode);
|
||||||
|
subject = subject.substring(0, i) + decoded + subject.substring(e + 2);
|
||||||
|
i += decoded.length();
|
||||||
|
s = subject.indexOf("=?", i);
|
||||||
|
e = subject.indexOf("?=", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
return subject;
|
return subject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue