mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-25 17:27:00 +00:00
Workaround incorrect UTF-16 meta
This commit is contained in:
parent
f48821fceb
commit
0f811d2c72
1 changed files with 5 additions and 2 deletions
|
@ -1793,11 +1793,14 @@ public class MessageHelper {
|
|||
|
||||
if (!TextUtils.isEmpty(charset))
|
||||
try {
|
||||
Log.i("Charset=" + meta);
|
||||
Charset detected = CharsetHelper.detect(result);
|
||||
Log.i("Charset detected=" + detected + " meta=" + meta);
|
||||
Charset c = Charset.forName(charset);
|
||||
if (c.equals(StandardCharsets.UTF_8) && !CharsetHelper.isUTF8(result))
|
||||
break;
|
||||
result = new String(result.getBytes(StandardCharsets.ISO_8859_1), charset);
|
||||
if (c.equals(StandardCharsets.UTF_16) && !c.equals(detected))
|
||||
break;
|
||||
result = new String(result.getBytes(StandardCharsets.ISO_8859_1), c);
|
||||
break;
|
||||
} catch (Throwable ex) {
|
||||
Log.w(ex);
|
||||
|
|
Loading…
Reference in a new issue