Improved mime word decoding

pull/159/head
M66B 5 years ago
parent ec59befb82
commit e65317bbe7

@ -645,13 +645,6 @@ public class MessageHelper {
subject = MimeUtility.unfold(subject); subject = MimeUtility.unfold(subject);
subject = new String(subject.getBytes(StandardCharsets.ISO_8859_1)); subject = new String(subject.getBytes(StandardCharsets.ISO_8859_1));
try {
subject = MimeUtility.decodeText(subject);
} catch (UnsupportedEncodingException ex) {
Log.w(ex);
}
subject = decodeMime(subject); subject = decodeMime(subject);
return subject; return subject;
@ -769,17 +762,16 @@ public class MessageHelper {
if (e < 0) if (e < 0)
break; break;
String decode = text.substring(s, e + 2); String encoded = text.substring(s, e + 2);
try { try {
String decoded = MimeUtility.decodeWord(decode); String decoded = MimeUtility.decodeWord(encoded);
text = text.substring(0, s) + decoded + text.substring(e + 2); text = text.substring(0, s).replaceAll("[ \t\n\r]$", "") + decoded + text.substring(e + 2);
i += decoded.length();
} catch (ParseException ex) { } catch (ParseException ex) {
Log.w(new IllegalArgumentException(text, ex)); Log.w(new IllegalArgumentException(text, ex));
i += decode.length(); i += encoded.length();
} catch (UnsupportedEncodingException ex) { } catch (UnsupportedEncodingException ex) {
Log.w(new IllegalArgumentException(text, ex)); Log.w(new IllegalArgumentException(text, ex));
i += decode.length(); i += encoded.length();
} }
} }

Loading…
Cancel
Save